[Perl5-syntax] Method signatures: are slurpy params optional
by default?
Matt S Trout
dbix-class at trout.me.uk
Tue May 3 20:06:40 GMT 2011
On 26/04/11 20:15, Buddy Burden wrote:
> David (and phaylon),
>
>> I assume that Perl 6 has not dropped the possibility of empty arrays.
>>
>> Empty arrays are valid syntax means that "an array argument" can be empty.
>
> I hear you guys, but--at least in the abstract--there is a difference
> between an empty array and no array at all. That is, I certainly
> agree that this:
>
> my @a = ();
> $obj->foo(@a);
>
> must be considered legal no matter what, but that's not technically the same as:
>
> $obj->foo();
>
> Now, as a practical matter, if we're talking about Perl5, there isn't
> really a way to distinguish between the two (barring some sort of Deep
> Magic(tm)). But perhaps in Perl6 there is; I dunno.
Perl6::Contexts actually manages to distinguish. But I think it's
probably better to accept that
>> From the abstract perspective, I'd still be curious to know how Perl6
> will handle such questions, if anyone has any insight.
You'd be better off asking the perl6 people if you want to know (though
I think the answer is that $obj->foo(@a) in the camelia spec is more
like $obj->foo(\@a) in perl5). This list is perl5-syntax for a reason -
we might love stealing our little sister's ideas but it's still a
different language :)
More information about the Perl5-syntax
mailing list