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

Support capture-by-reference and capture-mutable #2

Open
krame505 opened this issue May 2, 2018 · 0 comments
Open

Support capture-by-reference and capture-mutable #2

krame505 opened this issue May 2, 2018 · 0 comments

Comments

@krame505
Copy link
Member

krame505 commented May 2, 2018

Just a quick note-to-self for future implementation.

It wouldn't be that hard to implement capture-by-reference semantics as supported by C++. Such vars would be specified in the capture list as &a, like in C++, and for these would store a pointer in the env struct. Copy-out would instead copy the value in the pointer, and an additional copy-back operation at the end of the lambda would copy the final value of the var back into the pointer.

Similarly, we could also support C++'s mutable capture-by-value by making the env struct vars non-const and copying back the final values of all variables directly into the struct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant