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

Reference Or Clone?

Open hasezoey opened this issue 5 years ago • 0 comments

In the examples given, it is unclear to me: what are references to values and what are "clones"?

like the following:

let string1 = "String 1"
let string2 = string1 # will this be a clone or a reference?
let obj1 = {
  key1: "Key 1"
}
let obj2 = obj1 # will this be a clone or a reference?

(2 examples, because in a language like JavaScript, a primitive is a clone, and an object is a reference)

and for functions:

let func1 = fn (var1, var2) { } # will var1 & var2 be clones of the original values, or references?

hasezoey avatar Nov 10 '19 00:11 hasezoey