4 ms·
How does the type guessing and the type system in general work?
by peq 13y ago
How does the type guessing and the type system in general work?
- lucio 13y ago1. 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.