develooper Front page | perl.perl6.language | Postings from March 2005

Re: compile time signature checking

Thread Previous | Thread Next
Abhijit Mahabal
March 3, 2005 07:25
Re: compile time signature checking
Message ID:
Another edge case: is it legal to have an optional Pair in the 
signature? That is:
	sub foo($x, Pair ?$y, +$z){...}

If yes, what does this parse as:
	foo(10, z => 5);

If z => 5 is bound to $y, then $y is almost mandatory. ('almost' because 
we can still say foo(10); ). (and then can we also say foo(10, z => 5, z 
=> 6)? :) That at least has the feature that it can be used to write 
bizarre code like C< sing :e:i:e:i:o > )

If it is bound to $z instead, how do we bind anything to $y 
positionally? Might as well change that to +$y.

It seems to me that an optional Pair is a catastrophe waiting to happen, 
and maybe it should just be illegal (or produce a warning at least)

Sorry if this has been gone over before...


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About