empirical-lang icon indicating copy to clipboard operation
empirical-lang copied to clipboard

Function parameters are only being taken as reference

Open chrisaycock opened this issue 5 years ago • 0 comments

Found by @bobjansen:

func foo(x: Int64):
  x = x - 1
  return
end

let a = 7
print(a)
foo(a)
print(a)

This prints:

7
6

The parameter is being taken as a reference rather than a copy. This is related to the much bigger issue of copy-on-write requirements for memory management, as cryptically mentioned in the roadmap (#1).

chrisaycock avatar May 26 '19 13:05 chrisaycock