Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List.new loses Nil #6494

Open
p6rt opened this issue Sep 5, 2017 · 4 comments
Open

List.new loses Nil #6494

p6rt opened this issue Sep 5, 2017 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Sep 5, 2017

Migrated from rt.perl.org#132032 (status was 'open')

Searchable as RT132032$

@p6rt
Copy link
Author

p6rt commented Sep 5, 2017

From zefram@fysh.org

(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

@p6rt
Copy link
Author

p6rt commented Sep 15, 2017

From @zoffixznet

On Tue, 05 Sep 2017 03​:19​:45 -0700, zefram@​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)))␤»

@p6rt
Copy link
Author

p6rt commented Sep 15, 2017

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Sep 15, 2017

From @skids

On Fri, 15 Sep 2017 11​:47​:10 -0700, cpan@​zoffix.com wrote​:

On Tue, 05 Sep 2017 03​:19​:45 -0700, zefram@​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?

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant