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

Array.perl loses `is default` #6138

Open
p6rt opened this issue Mar 9, 2017 · 5 comments
Open

Array.perl loses `is default` #6138

p6rt opened this issue Mar 9, 2017 · 5 comments
Labels
Bug

Comments

@p6rt
Copy link

@p6rt p6rt commented Mar 9, 2017

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

Searchable as RT130963$

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented Mar 9, 2017

From zefram@fysh.org

my @​a is default(Nil); @​a[0] = Nil
Nil
@​a[0]
Nil
@​a.perl.EVAL[0]
(Any)

.perl.EVAL fails to round-trip the Nil element value in the Array.
Nil itself round-trips fine, so the failure here is specific to the Array.

-zefram

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented Mar 9, 2017

From @zoffixznet

On Thu, 09 Mar 2017 04​:06​:27 -0800, zefram@​fysh.org wrote​:

my @​a is default(Nil); @​a[0] = Nil
Nil
@​a[0]
Nil
@​a.perl.EVAL[0]
(Any)

.perl.EVAL fails to round-trip the Nil element value in the Array.
Nil itself round-trips fine, so the failure here is specific to the Array.

-zefram

Looks to me it's not Nil it's losing, it's the `is default` that it's losing​:

  $ perl6 -e 'my @​a is default(42); say @​a[^3]; @​a.perl.EVAL[^3].say'
  (42 42 42)
  ((Any) (Any) (Any))

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented Mar 9, 2017

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

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented Mar 9, 2017

From @zoffixznet

And without `is default(Nil)` a Nil value would assume whatever the `is default` is (which by default is Any)

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented Mar 9, 2017

From zefram@fysh.org

Zoffix Znet via RT wrote​:

Looks to me it's not Nil it's losing, it's the `is default` that it's losing​:

That's a reasonable way to look at it. Note that a binding also loses
its bindiness​:

my @​a; @​a[0] := Nil
Nil
@​a[0]
Nil
@​a.perl.EVAL[0]
(Any)
@​a.perl.EVAL[0] = 3
3
@​a[0] = 3
Cannot modify an immutable Nil
  in block <unit> at <unknown file> line 1

-zefram

@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
Projects
None yet
1 participant
You can’t perform that action at this time.