-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
meta-discussionDiscussions and resourcesDiscussions and resourcestheme-internalsRelates to internal operations of the languageRelates to internal operations of the languagetype-designDiscussion regarding design of enhancements or project at largeDiscussion regarding design of enhancements or project at large
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:
- In R,
data.tableis 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 thelgrpackage. - 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.
- If one provides an
Environmentstructure, 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.
Metadata
Metadata
Assignees
Labels
meta-discussionDiscussions and resourcesDiscussions and resourcestheme-internalsRelates to internal operations of the languageRelates to internal operations of the languagetype-designDiscussion regarding design of enhancements or project at largeDiscussion regarding design of enhancements or project at large