[perl #131508] [BUG] `state` with % is Sethash in whenever block ends up with a type object on second iteration
[email protected] ("Zoffix Znet via RT") Tue, 06 Mar 2018 17:26:24 -0800
| Newsgroups | perl.perl6.compiler |
|---|---|
| Message-ID | <[email protected]> |
On Sun, 04 Jun 2017 07:12:25 -0700, [email protected] 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()SetHashTried to > get the result of a broken Promise in block <unit> at <tmp> line > 1Original 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")SetHashSetHash» ```