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

Re: Optional binding

Thread Previous | Thread Next
From:
David Storrs
Date:
March 7, 2005 17:38
Subject:
Re: Optional binding
Message ID:
20050308013753.GC76193@megazone.bigpanda.com
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
this:

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


--Dks

-- 
dstorrs@dstorrs.com

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About