Skip Menu |
Report information
Id: 130963
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: zefram [at] fysh.org
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Date: Thu, 9 Mar 2017 12:05:10 +0000
Subject: [BUG] Array.perl.EVAL loses Nil
From: Zefram <zefram [...] fysh.org>
To: rakudobug [...] perl.org
Download (untitled) / with headers
text/plain 229b
Show quoted text
> my @a is default(Nil); @a[0] = Nil
Nil Show quoted text
> @a[0]
Nil Show quoted text
> @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
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 502b
On Thu, 09 Mar 2017 04:06:27 -0800, zefram@fysh.org wrote: Show quoted text
> > 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))
Download (untitled) / with headers
text/plain 109b
And without `is default(Nil)` a Nil value would assume whatever the `is default` is (which by default is Any)
Date: Thu, 9 Mar 2017 14:18:42 +0000
To: Zoffix Znet via RT <perl6-bugs-followup [...] perl.org>
From: Zefram <zefram [...] fysh.org>
Subject: Re: [perl #130963] [BUG] Array.perl.EVAL loses Nil
Download (untitled) / with headers
text/plain 375b
Zoffix Znet via RT wrote: Show quoted text
>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: Show quoted text
> my @a; @a[0] := Nil
Nil Show quoted text
> @a[0]
Nil Show quoted text
> @a.perl.EVAL[0]
(Any) Show quoted text
> @a.perl.EVAL[0] = 3
3 Show quoted text
> @a[0] = 3
Cannot modify an immutable Nil in block <unit> at <unknown file> line 1 -zefram


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org