Possibility for call-by reference
- Dominant language
- Rust
- Stars
- 145
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
I am not sure whether this is desirable but I think it might be worth to consider the possibility for allowing call-by-reference semantics. In `C++`, e.g., the `&` in the function signature `void mutate(double& x);` causes the `x` to be passed by-reference and is therefore mutable from within the function.
I think there are some arguments in favor of allowing for a standardized interface for reference semantics:
1. In R, `data.table` is a very widely used library and uses references semantics for performance. So there is demand for such a mechanism. Another prominent example is `R6`, which definitely also has it's use-cases, e.g. for logging via the `lgr` package.
2. If one does not provide a proper mechanism for reference semantics, people will still be able to achieve this in a probably more hacky way.
3. If one provides an `Environment` structure, the language already has references semantics so extending this to other data types does not seem to big of a stretch.
The argument against references semantics I think is that it introduces a lot of complexity, consider e.g. the whole shared vs exclusive reference mechanism in rust.
Contributor guide
No contributing guide indexed for this repository
Research direction
No files, tests, or entry points are named. Start by reviewing the existing Environment structure and reference semantics in the Rust implementation, then clarify the desired call-by-reference model and its trade-offs. Done would require an agreed design with concrete behavior and acceptance criteria.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, r, rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100