Classes & Objects (TBD)
Objects & classes are currently not implemented in THT.
Previous Beta versions had a fledgling object system, but it was removed in order to focus more on the core language.
This will go along with support for type hints.
If you have opinions on what you’d like the object system to be, feel free to let me know on Discord.
Temporary System
In the interim, you can create ad hoc objects that behave like JavaScript objects by assigning functions to Maps.
Use the @
symbol as an alias for $this
, which refers to the current Map.
$obj = { val: 123 appendVal: fun ($str) { return $str ~ @.val } } $obj.appendVal('abc') //= 'abc123'