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

Iterators that don't use pull-one, lose containers #4668

Closed
p6rt opened this issue Oct 21, 2015 · 4 comments
Closed

Iterators that don't use pull-one, lose containers #4668

p6rt opened this issue Oct 21, 2015 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Oct 21, 2015

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

Searchable as RT126424$

@p6rt
Copy link
Author

p6rt commented Oct 21, 2015

From @lizmat

# 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 <unit> 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

@p6rt
Copy link
Author

p6rt commented Dec 13, 2015

From @jnthn

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 <unit> 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.

@p6rt
Copy link
Author

p6rt commented Dec 13, 2015

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

@p6rt
Copy link
Author

p6rt commented Dec 13, 2015

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

@p6rt p6rt closed this as completed Dec 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant