Re:Show HN: LiteScript
by peq on Sunday March 09, 2014 @11:26AM
(#7368652)
How does the type guessing and the type system in general work?
[ Parent
| on HN ]
1. Type guessing:
- if you have a "class Token" and later do "var token", the type is guessed by name affinity.
- if you do:
token = .getToken()
other = token
the type of "other" is guessed from assignment (:Token)2. Type annotations: you directly state type
var other:Token
var read: Token array
The compiler does a "pseudo-execution" of the AST, guessing types and validating property access.