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

for @a is not creating containers for uninitialized elements #4636

Closed
p6rt opened this issue Oct 9, 2015 · 6 comments
Closed

for @a is not creating containers for uninitialized elements #4636

p6rt opened this issue Oct 9, 2015 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Oct 9, 2015

Migrated from rt.perl.org#126312 (status was 'resolved')

Searchable as RT126312$

@p6rt
Copy link
Author

p6rt commented Oct 9, 2015

From @lizmat

$ 6 'my Int @​a; @​a[5] = 42; $_ = 666 for @​a'
Cannot assign to an immutable value
  in block <unit> at -e​:1

[23​:11​:32] <lizmat> .tell jnthn my Int @​a; @​a[5] = 42; $_ = 666 for @​a fails because it gets an IterationBuffer as target, not an ArrayReificationTarget
[23​:12​:26] <lizmat> .tell the IterationBuffer doesn't have a descriptor

So I think it could be a code gen issue. And is my previous fix for​:

$ 6 'my Int @​a; @​a[5] = 42; .say for @​a'
(Int)
(Int)
(Int)
(Int)
(Int)
42

basically wrong, as we don’t have typed lists (and those (Int) are appearing there because I took the .of of the given list, which gives the right type, but no descriptor. In other words, for the @​a case, it should never wind up in the List iterator anyway?

Liz

@p6rt
Copy link
Author

p6rt commented May 7, 2016

From @smls

Confirmed on current Rakudo.

Interestingly, it works if `for @​a` is replaced with `for @​a[*]`​:

  ➜ my Int @​a; @​a[5] = 42; $_ = 100 for @​a[*]; say @​a;
  [100 100 100 100 100 100]

@p6rt
Copy link
Author

p6rt commented Feb 6, 2018

From @dogbert17

On Sat, 07 May 2016 13​:26​:09 -0700, smls75@​gmail.com wrote​:

Confirmed on current Rakudo.

Interestingly, it works if `for @​a` is replaced with `for @​a[*]`​:

➜  my Int @&#8203;a;  @&#8203;a\[5\] = 42;   $\_ = 100 for @&#8203;a\[\*\];  say @&#8203;a;
\[100 100 100 100 100 100\]

Seems to have been fixed with Rakudo commit 069b789af545dff30d450618fae82ccb82579346.
Tests needed.

@p6rt
Copy link
Author

p6rt commented Feb 6, 2018

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

@p6rt
Copy link
Author

p6rt commented Apr 7, 2018

From @AlexDaniel

Tests added in Raku/roast@d78f339

Closing

On 2018-02-06 14​:12​:56, jan-olof.hendig@​bredband.net wrote​:

On Sat, 07 May 2016 13​:26​:09 -0700, smls75@​gmail.com wrote​:

Confirmed on current Rakudo.

Interestingly, it works if `for @​a` is replaced with `for @​a[*]`​:

➜ my Int @​a; @​a[5] = 42; $_ = 100 for @​a[*]; say @​a;
[100 100 100 100 100 100]

Seems to have been fixed with Rakudo commit
069b789af545dff30d450618fae82ccb82579346.
Tests needed.

@p6rt
Copy link
Author

p6rt commented Apr 7, 2018

@AlexDaniel - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant