import sets
var h: HashSet[string]
proc main =
h.incl("Nim")
let b = h
h.incl("VLang")
h = b
echo h.contains("VLang")
main()
Run
The output is true.
But with "var b" it would be false. So it seems that "let b = h" creates just
an alias.
I can now remember a similar case some years ago. But it is too hard to always
have in mind that the code above with let is only an alias. With strings it
seems to work like a real copy, and when all code is in global scope it seems
to work also like a copy.
Nim Compiler Version 1.1.1 [Linux: amd64]
Compiled at 2020-03-26
Run