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

state with % is Sethash ends up with a type object on second entry to block #6324

Open
p6rt opened this issue Jun 4, 2017 · 2 comments
Open
Labels

Comments

@p6rt
Copy link

p6rt commented Jun 4, 2017

Migrated from rt.perl.org#131508 (status was 'new')

Searchable as RT131508$

@p6rt
Copy link
Author

p6rt commented Jun 4, 2017

From @zoffixznet

%goods here works as expected​:

<Zoffix__> m​: my %goods is SetHash; react whenever Supply.interval(.3) { $++ > 3 and done; dd %goods; %goods<foo>++; }
<camelia> rakudo-moar 3755c0​: OUTPUT​: «SetHash.new()␤SetHash.new("foo")␤SetHash.new("foo")␤SetHash.new("foo")␤»

On second iteration ends up being a type object​:

<Zoffix__> m​: react whenever Supply.interval(.3) { state %goods is SetHash; $++ > 3 and done; dd %goods; %goods<foo>++; }
<camelia> rakudo-moar 3755c0​: OUTPUT​: «SetHash.new()␤SetHash␤Tried to get the result of a broken Promise␤ in block <unit> at <tmp> line 1␤␤Original exception​:␤ Cannot modify an immutable SetHash ((SetHash))␤ in block at <tmp> line 1␤␤»

@p6rt
Copy link
Author

p6rt commented Mar 7, 2018

From @zoffixznet

On Sun, 04 Jun 2017 07​:12​:25 -0700, cpan@​zoffix.com wrote​:

%goods here works as expected​:

<Zoffix__> m​: my %goods is SetHash; react whenever Supply.interval(.3)
{ $++ > 3 and done; dd %goods; %goods<foo>++; }
<camelia> rakudo-moar 3755c0​: OUTPUT​:
«SetHash.new()␤SetHash.new("foo")␤SetHash.new("foo")␤SetHash.new("foo")␤»

On second iteration ends up being a type object​:

<Zoffix__> m​: react whenever Supply.interval(.3) { state %goods is
SetHash; $++ > 3 and done; dd %goods; %goods<foo>++; }
<camelia> rakudo-moar 3755c0​: OUTPUT​: «SetHash.new()␤SetHash␤Tried to
get the result of a broken Promise␤ in block <unit> at <tmp> line
1␤␤Original exception​:␤ Cannot modify an immutable SetHash
((SetHash))␤ in block at <tmp> line 1␤␤»

Another case​:

```
<Zoffix_> m​: <a b c>.grep​: { (state %code-files is SetHash = <foo bar>); LEAVE dd %code-files; }
<camelia> rakudo-moar dd2c90192​: OUTPUT​: «SetHash.new("foo","bar")␤SetHash␤SetHash␤»
```

@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