Hi,

Juerd wrote:
> Ingo Blechschmidt skribis 2005-10-10 19:36 (+0200):
>>     my @array = (42, "hi", (a => 23));
> 
> It is worth pointing out that the inner parens here are merely for
> grouping: this information is lost afterwards, hence this:
> 
>>     foo [EMAIL PROTECTED];  # same as
> 
> shouldn't be
> 
>>     foo 42, "hi", (a => 23);  # three positional params (Int, Str,
>>     Pair)
> 
> but instead
> 
>     foo 42, "hi", a => 23  # two positional args, one named.
> 
> OR pairs need to remember whether they were originally in parens. This
> is very doable, but whether we want or need it is very arguable.

Luckily, this is not needed, see my response to Dave [1]:

Because named arguments are purely syntactic (i.e., they are not objects
or some other kind of data type), you can't stuff them into an array
(or a scalar, for that matter).

    # (assuming => binds thighter than =)
    my $scalar = a => 1;  # sugar for
    my $scalar = (a => 1);

    my @array = (42, a => 1);  # sugar for
    my @array = (42, (a => 1));

Named arguments can -- under the proposal -- only ever exist in calls.


--Ingo

[1] http://www.nntp.perl.org/group/perl.perl6.language/23438

Reply via email to