[perl #132032] [BUG] List.new loses Nil

2017-09-15 Thread Brian S. Julin via RT
On Fri, 15 Sep 2017 11:47:10 -0700, c...@zoffix.com wrote:
> On Tue, 05 Sep 2017 03:19:45 -0700, zef...@fysh.org wrote:
> > > (3, Nil)
> > (3 Nil)
> > > List.new(3, Nil)
> > (3 (Any))
> >
> > It is possible (as it should be) to put Nil into a List, if it's
> > constructed using the comma operator.  But constructing it via the
> > List.new() constructor replaces the Nil with Any.  I think this is a
> > bug
> > in List.new(): it should accept any argument, including Nil, and put
> > it
> > into a List.
> >
> > -zefram
> 
> 
> Also spotting similar behaviour with Map.new. Since (unlike a Hash),
> it's not creating containers for its things, I'd expect it to retain
> the Nil as Nil.
> 
> m: dd Map.new: ("z", Nil)
> rakudo-moar f925c6: OUTPUT: «Map.new((:z(Any)))␤»

As with #130970 I think this is just a matter of deciding what
slurpy/is_raw behavior each of these should have and updating
docs/spec/code accordingly.  Just before doing that, we need to check
on what the roadmap is for some of these types -- are they supposed
to be parameterizable and/or have defaults in the future, or not?
If so, can we specify, rather than just leave it up to conjecture,
that the default parameterization with no default applied will take Nils?


[perl #132032] [BUG] List.new loses Nil

2017-09-15 Thread Zoffix Znet via RT
On Tue, 05 Sep 2017 03:19:45 -0700, zef...@fysh.org wrote:
> > (3, Nil)
> (3 Nil)
> > List.new(3, Nil)
> (3 (Any))
> 
> It is possible (as it should be) to put Nil into a List, if it's
> constructed using the comma operator.  But constructing it via the
> List.new() constructor replaces the Nil with Any.  I think this is a bug
> in List.new(): it should accept any argument, including Nil, and put it
> into a List.
> 
> -zefram


Also spotting similar behaviour with Map.new. Since (unlike a Hash), it's not 
creating containers for its things, I'd expect it to retain the Nil as Nil.

m: dd Map.new: ("z", Nil)
rakudo-moar f925c6: OUTPUT: «Map.new((:z(Any)))␤»


[perl #132032] [BUG] List.new loses Nil

2017-09-15 Thread Zoffix Znet via RT
On Tue, 05 Sep 2017 03:19:45 -0700, zef...@fysh.org wrote:
> > (3, Nil)
> (3 Nil)
> > List.new(3, Nil)
> (3 (Any))
> 
> It is possible (as it should be) to put Nil into a List, if it's
> constructed using the comma operator.  But constructing it via the
> List.new() constructor replaces the Nil with Any.  I think this is a bug
> in List.new(): it should accept any argument, including Nil, and put it
> into a List.
> 
> -zefram


Also spotting similar behaviour with Map.new. Since (unlike a Hash), it's not 
creating containers for its things, I'd expect it to retain the Nil as Nil.

m: dd Map.new: ("z", Nil)
rakudo-moar f925c6: OUTPUT: «Map.new((:z(Any)))␤»


[perl #132032] [BUG] List.new loses Nil

2017-09-05 Thread via RT
# New Ticket Created by  Zefram 
# Please include the string:  [perl #132032]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=132032 >


> (3, Nil)
(3 Nil)
> List.new(3, Nil)
(3 (Any))

It is possible (as it should be) to put Nil into a List, if it's
constructed using the comma operator.  But constructing it via the
List.new() constructor replaces the Nil with Any.  I think this is a bug
in List.new(): it should accept any argument, including Nil, and put it
into a List.

-zefram