-
-
Notifications
You must be signed in to change notification settings - Fork 52
Allow adding modifiers to function arguments, like mut and ref #612
Copy link
Copy link
Closed
Labels
ark/compilerRelated to the compilerRelated to the compilerark/formatterArkScript code formatterArkScript code formatterark/parserParser relatedParser relatedark/virtual machineRelated to the ark virtual machineRelated to the ark virtual machinedocumentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or request💥 breaking changeIndicate that the issue/PR is bringing breaking change(s) in the languageIndicate that the issue/PR is bringing breaking change(s) in the language
Metadata
Metadata
Assignees
Labels
ark/compilerRelated to the compilerRelated to the compilerark/formatterArkScript code formatterArkScript code formatterark/parserParser relatedParser relatedark/virtual machineRelated to the ark virtual machineRelated to the ark virtual machinedocumentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or request💥 breaking changeIndicate that the issue/PR is bringing breaking change(s) in the languageIndicate that the issue/PR is bringing breaking change(s) in the language
Type
Fields
Give feedbackNo fields configured for issues without a type.
Is your feature request related to a problem?
Function arguments are always mutable, however they shouldn’t, to be in line with the language philosophy.
There is also no way of passing references to big lists to functions, to avoid copying them. Copying data and not passing hidden references is good, though we should be able to explicitly request a reference when defining a function.
Describe the solution you would like
I’d like to be able to write something like
Setting the mutability or immutability of an argument would only impact the NameScopeResolver that does the checks for this.
Specifying an argument as a ref is harder and will need modifications to operators, type checking, builtins, scope resolver (as ref will be mutable by default).
Is it a big modification to the language? Leave it if you don't know