[perl #126424] Iterators that don't use pull-one, lose containers
On Wed Oct 21 15:40:57 2015, elizabeth wrote: > # this internally uses .push-at-least > $ 6 'my $l = gather { take-rw my $ = 1 }; $l.AT-POS(0) = 42' > Cannot modify an immutable Int > in block at -e:1 > > # this internally uses .pull-one > $ 6 'my $l = gather { take-rw my $ = 1 }; for @$l { $_ = 42 }; dd > $l.AT-POS(0)' > Int $var = 42 > > The former follows List!AT-POS-SLOWPATH, which in turn calls .push-at- > least. The latter does a .pull-one. > > > There were some “is raw” missing, but not on the AT-POS’s that were > encountered in this example. > > Also considered that we would need to have a Mu on the $pulled in > Iterator.push-at-least. > > > I also checked pushing to IterationBuffer: > > $ 6 'my $b = IterationBuffer.new; my $a = 42; $b.push($a); dd $b[0] = > 666' > Int $var = 666 > > So, I’m not sure anymore what TF is going on :-( > Tracked it down. It wasn't actually anything to do with pull-one vs. push-at-least in the end, but instead that AT-POS in Seq was lacking "is raw". Added that, it things worked. Test coverage in S04-statements/gather.t.
[perl #126424] Iterators that don't use pull-one, lose containers
# New Ticket Created by Elizabeth Mattijsen # Please include the string: [perl #126424] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=126424 > # this internally uses .push-at-least $ 6 'my $l = gather { take-rw my $ = 1 }; $l.AT-POS(0) = 42' Cannot modify an immutable Int in block at -e:1 # this internally uses .pull-one $ 6 'my $l = gather { take-rw my $ = 1 }; for @$l { $_ = 42 }; dd $l.AT-POS(0)' Int $var = 42 The former follows List!AT-POS-SLOWPATH, which in turn calls .push-at-least. The latter does a .pull-one. There were some “is raw” missing, but not on the AT-POS’s that were encountered in this example. Also considered that we would need to have a Mu on the $pulled in Iterator.push-at-least. I also checked pushing to IterationBuffer: $ 6 'my $b = IterationBuffer.new; my $a = 42; $b.push($a); dd $b[0] = 666' Int $var = 666 So, I’m not sure anymore what TF is going on :-( Liz