Possibility for call-by reference #214
Labels
meta-discussion
Discussions and resources
theme-internals
Relates to internal operations of the language
type-design
Discussion regarding design of enhancements or project at large
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 signaturevoid mutate(double& x);
causes thex
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:
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 isR6
, which definitely also has it's use-cases, e.g. for logging via thelgr
package.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.
The text was updated successfully, but these errors were encountered: