Skip to content

Allow adding modifiers to function arguments, like mut and ref #612

@SuperFola

Description

@SuperFola

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

(let foo (fun (x (mut y) (ref data))
  …))

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

  • Breaking change
  • Compiler/syntax modifications
  • Runtime modifications (standard library, modules, packages...)

Metadata

Metadata

Assignees

Labels

ark/compilerRelated to the compilerark/formatterArkScript code formatterark/parserParser relatedark/virtual machineRelated to the ark virtual machinedocumentationImprovements or additions to documentationenhancementNew feature or request💥 breaking changeIndicate that the issue/PR is bringing breaking change(s) in the language

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions