Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How does the type guessing and the type system in general work?


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: