[Perl5-syntax] Method signatures: are slurpy params optional by default?

Buddy Burden barefootcoder at gmail.com
Tue Apr 26 20:15:10 GMT 2011


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.

But I think you've pretty much answered the question in terms of what
to do with MS, in that, whether we agree that the second call above
should be legal or not, the first one _has_ to be allowed, which means
the second one has to be allowed too.  So I think, from the practical
perspective, that I'll submit a patch on that.

>From the abstract perspective, I'd still be curious to know how Perl6
will handle such questions, if anyone has any insight.


            -- Buddy



More information about the Perl5-syntax mailing list