4 ms·
I came to JS after spending years in C# and Java, and so I liked the dynamically-typed nature of the language. It feels a lot freer, to me. Of course I understa
by draw_down 9y ago
I came to JS after spending years in C# and Java, and so I liked the dynamically-typed nature of the language. It feels a lot freer, to me. Of course I understand why people think static typing is important, but going back to that way of denoting what everything is just seems so onerous.
But even regardless of that, what I really hate is how these typed JS variants introduce so much extra syntax and -- sorry for my phraseology -- crap into the language.
Here is an example of Flow:
declare function isMap(m: mixed): boolean %checks(m instanceof Map);
You can call that whatever you want, but JavaScript it ain't.
- shakna 9y agoType deduction isn't a terrible hardship, and should make the code look dynamic. A simple debugging output can attach the types visibly. So... My question is why these statically typed JSs add such verbose syntax? Even C++ has had auto to avoid irritating boilerplate.
- girvo 9y agoFlow doesn't require you to write what's above at all for the most part, and it's type inference and flow analysis is amazing. Your applications code will have few type hints if that's what you want, and your core libraries can have the extremely specific types as what's show in the parent post. I dunno, I like TS and Flow, and gradual typing with excellent inference means it rarely gets in my way, even when calling out to JS libraries that are as dynamic and loose as you can get.
- girvo 9y agoSure, but that isn't JavaScript and isn't needed at runtime anyway. It's literally stripped out, not even compiled (unlike TS)! Flows type system is amazingly powerful, too, which I adore. So I'm biased; being able to emulate HKTs with real type checking gives me the dynamic power of JS with the type safety I want; and it's an easier sell than Purescript ;)