4 ms·
1. There's a compiler validation phase, it guess types from definitions and assignments, and will caught typos in object properties, saving hours of debugging s
by lucio 13y ago
1. There's a compiler validation phase, it guess types from definitions and assignments, and will caught typos in object properties, saving hours of debugging subtle bugs.
2. No callback hell while keeping async programming ("yield until", node.js --harmony)
- peq 13y agoHow 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.
- ulisesrmzroche 13y agoDoes this depend on using --harmony? Or are you faking the generators?
- lucio 13y agotoday it depends on --harmony (only for "yield"), but it is trivial to add an option to use node-fibers instead (same functionality of ES6-generators for node>=v0.8). See https://github.com/luciotato/waitfor https://github.com/luciotato/waitfor ,node-fibers, and the same with generators: https://github.com/luciotato/waitfor-ES6 https://github.com/luciotato/waitfor-ES6
- ulisesrmzroche 13y agoIt's good that it's not faking generators though, stick with harmony. Fakes slow to a crawl after a while.