r/programming • • Mar 16 '16

The Deep Roots of Javascript Fatigue

https://segment.com/blog/the-deep-roots-of-js-fatigue/
143 Upvotes

67 comments sorted by

View all comments

15

u/CookieOfFortune Mar 16 '16

Well, I've been transitioning to React and Typescript so... hopefully I'm betting on the right fads?

2

u/aphexairlines Mar 16 '16

50/50 chance of survival between TypeScript (more tooling investment by MS in 2015) and Flow (better type-checking and catching up on editor support).

I'm betting on Flow, but it's a toss-up.

3

u/[deleted] Mar 17 '16

I have only read small bits of flow online but it looks like it's just re-inventing TypeScript. The only innovative aspect I see is null checks (which is huge), but everywhere else it does the same or less.

2

u/aphexairlines Mar 18 '16

See https://code.facebook.com/posts/1505962329687926/flow-a-new-static-type-checker-for-javascript/ for some of the differences:

underlying the design of Flow is the assumption that most JavaScript code is implicitly statically typed

... Flow infers those types automatically wherever possible

... developers can check their code for type errors without having to explicitly annotate that code with types.

This makes Flow fundamentally different than existing JavaScript type systems (such as TypeScript), which make the weaker assumption that most JavaScript code is dynamically typed, and that it is up to the developer to express which code may be amenable to static typing. In general, such a design leads to reduced coverage: Fewer type errors are caught, and tools are less effective. While this is a reasonable choice for some code, in general such a design does not provide as many benefits as it could without significant additional effort.

2

u/[deleted] Mar 18 '16

But TypeScript also uses type inference.

It also doesn't use static typing. It uses structural typing. There is a big difference and that's what makes it map so well on top of a dynamic language.

Flow still sounds like it's reinventing the wheel.