gorillascript icon indicating copy to clipboard operation
gorillascript copied to clipboard

Mutable arrays and objects

Open Fresheyeball opened this issue 11 years ago • 1 comments

I would expect this to throw an error.

let arr = [1,2,3,4]
arr.push 5

I would also expect this to throw an error or do a clone

let arr = [1,2,3]
let mutable arrrr = arr

Fresheyeball avatar Apr 01 '14 17:04 Fresheyeball

It states in the docs that objects are always mutable, but the variables that point to the object are not. Check out the documentation. Me personally, I'd like to be able to specify properties on objects to be immutable, and also have type checking on object properties.

kkirby avatar Apr 03 '14 14:04 kkirby