On May 23, 2009 11:31:35 pm John M. Dlugosz wrote:
> Henry Baragar Henry.Baragar-at-instantiated.ca |Perl 6| wrote:
> >>> > sub f2 (@y) {say @y.WHAT; say +...@y}; f2(Nil);
> >>>
> >>> Array()
> >>> 1
> >>
> >> Why doesn't +...@y produce 0, not 1? It's an empty list.
> >
> > From rakudo:
> > > sub f2 (@y) {say @y[0]}; f2(Nil);
> >
> > Nil()
> >
> > Henry
>
> Uh, @y is an Array of one item, that one item being Nil.
>
> I think the intent was to be an empty list. Nil is not supposed to go
> into lists, but to become nothing when used in such a way. Wrapping Nil
> into a list when it wasn't a list at all to begin with is totally
> missing the point. And where did the wrapping Array come from?
>
Good question, since Nil does Positional, as evidenced by rakudo:
> say Nil ~~ Positional
1
Should report this as a bug?
Henry
> At its
> simplest, Nil is an object whose Positional personality shows an empty
> list, and that's what the @ variable uses.
>
> --John
--
Henry Baragar
Instantiated Software
416-907-8454 x42