You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The new variable indirection would allow to pass function arguments by reference: the caller would pass a variable name as an argument, and the function would use read or write on @this to access the variable.
However, allowing to do so has some drawbacks:
It would introduce variable aliasing into the language, making optimizations much more difficult.
The set of variables accessed by a function would depend on all function calls (probably a subproblem of the previous point).
Only variables backed by a processor variable could be passed by reference. This means that e.g. external variables or array elements with non-constant indexes couldn't be passed by reference. It's not that difficult to implement the restriction, but it would introduce inconsistencies into the language.
Accessing variables this way is costlier and would prevent some optimizations within the function, compared to existing output parameters.
Given the above points, support for passing function arguments by reference is not currently planned.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The new variable indirection would allow to pass function arguments by reference: the caller would pass a variable name as an argument, and the function would use
readorwriteon@thisto access the variable.However, allowing to do so has some drawbacks:
Given the above points, support for passing function arguments by reference is not currently planned.
Beta Was this translation helpful? Give feedback.
All reactions