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

lazy rw in map #2035

Closed
p6rt opened this issue Aug 7, 2010 · 4 comments
Closed

lazy rw in map #2035

p6rt opened this issue Aug 7, 2010 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Aug 7, 2010

Migrated from rt.perl.org#77074 (status was 'rejected')

Searchable as RT77074$

@p6rt
Copy link
Author

p6rt commented Aug 7, 2010

From oha@oha.it

map-ed items are rw and map results are lazy, but the "lazy thing" is
bound only to the output​:

my @​in = 1..4;
my @​out := @​in.map({$_*=10;});
say @​in[1]; # expected 20, got 2
say @​out[2]; # expected 30, got 30
say @​in[1]; # got 20 now but may depend on implementation i think

personally i expected that -- with the introduction of rw trait on
blocks -- for and map aren't aliasing anymore by default

@p6rt
Copy link
Author

p6rt commented Dec 12, 2012

From @timo

< pmichaud> I think RT #​77074 is wrong in terms of what it expects.
< pmichaud> the first @​in[1] should definitely be 2, not 20
< pmichaud> because array assignment is mostly eager
< pmichaud> I think it could be closed as "not a bug"
< jnthn> my @​out := @​in.map({$_*=10;}); # this binding means we don't
evaluate the map eagerly, since binding is not mostly eager
< jnthn> So yeah, think it's not a bug.

@p6rt
Copy link
Author

p6rt commented Dec 12, 2012

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

@p6rt
Copy link
Author

p6rt commented Dec 12, 2012

@timo - Status changed from 'open' to 'rejected'

@p6rt p6rt closed this as completed Dec 12, 2012
@p6rt p6rt added the notabug 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