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

Re: Optional binding

Thread Previous | Thread Next
David Storrs
March 7, 2005 17:38
Re: Optional binding
Message ID:
On Mon, Mar 07, 2005 at 04:58:29PM -0800, Larry Wall wrote:
> In fact, we really haven't specified what happens when you say
>     my Int @a is shape(3) := [1,2];
>     my Int @b is shape(3) := [1,2,3,4];
> But I also have this nagging feeling that the user wouldn't have
> specified shape(3) unless they actually meant it.  But I suspect
> that in the typical case, they really do want a 3-element vector,
> nothing more, nothing less.

I agree that this is undoubtedly what they meant.  I wonder though, if
there is then any way to explicitly leave off an element.  Can I do

	sub foo( Int @a is shape(3) ) { ... }
	foo(1, 2, undef);



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