On Fri, 20 Sep 2002, David Whipp wrote:
> Larry wrote:
> > :   $shouldbe3 = (1,2,3) + 0;
> >
> > It's 3, though not for the reason a Perl 5 programmer would think.
> > (In Perl 6 it's the length of the anonymous array, not the
> > last value.)
>
> This kind of clever magic always makes me nervous:
> it introduces subtle bug potentials.
>
>   (7,8,9) == 3 # true
>   (7,8)   == 2 # true
>   (7)     == 1 # false
>   ()      == 0 # true?
I believe the last two cases should be:

    (7,)    == 1
    (,)     == 0

Because its the perl6 comma that creates the list, not the parenthesis.

~ John Williams


Reply via email to