locals
= declares new locals.
So does in a. b in object builders.
:= changes an existing local's value.
Unlike in JS,
= can never be used to change a value, and := can't be used as an expression.a = 1 . a a := 2 . a
Locals are local to the block they're declared in.
The compiler will stop you if you try to access an uninitialized local.
properties
To access a property on an object, use obj.prop.
To access a property on this, use .prop.
obj = {x. 0}
. obj.x
f = .\
|| Equivalent to `this.x`
.x
. f.call obj
:= can also set property values.
obj = {x. 1}
obj.y := 2
obj
To access any string as a property, use obj."foo" equivalent to obj.("foo").
To access any value as a property, use obj.(foo).
:= can use this syntax too.
obj = {"wierd name". 1}
. obj."wierd name"
obj."wierd name" := 2
key = "wierd name"
. obj.(key)