Skip to content

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

@krame505

Description

@krame505

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions