Re:Facebook Launches Flow, Static Type Checker for JavaScript
by avik on Tuesday November 18, 2014 @08:19PM
(#8627606)
We have some basic editor support, more is coming soon. Flow exposes several commands that are useful through an editor, like type-at-pos (give it a position, it gives you back the inferred type), suggest (give it a file, it dumps out an annotated file), autocomplete (gives you suggestions at a given position), etc. Also, we require annotations at module boundaries, so you're modules are going to have well-typed interfaces that serve well for both documentation and stability.
Re:Facebook Launches Flow, Static Type Checker for JavaScript
by hyp0 on Tuesday November 18, 2014 @11:26PM
(#8628266)
I strongly agree with module typing (and being more relaxed within). Because of caller dependence on modules, the difficulty of changing static types becomes a benefit. Plus, they need to be documented anyway; and tooling support helps use they as if they were primitives.
As others have said, I love the approach of inference giving static type benefits, for free. If you get tooling support, at no extra work, why not adopt it?
But static types can be a hard sell for JS programmers. What sort of reception has it gotten inside facebook?
Re:Facebook Launches Flow, Static Type Checker for JavaScript
by avik on Wednesday November 19, 2014 @11:24PM
(#8634423)
Still early days but the reception has been strongly positive. We may be a biased bunch but we like our code mostly statically typed with the flexibility provided by dynamically typed languages. A large part of this culture is due to the immense internal success of Hack (http://hacklang.org/).
Re:Facebook Launches Flow, Static Type Checker for JavaScript
by ep103 on Wednesday November 19, 2014 @09:42AM
(#8630245)
you should check out sublime text if you haven't already. ST3 reads your js as you type it, and allows you to navigate through the code like you would through visual studio, keeping a dictionary of where the words appear and guessing what they are as. Its not as good as a static languages navigational abilities (you may have to choose between jumping to Increment the function, and Increment the variable), but its still pretty good.
This tool claims it can do advanced inference. If it were possible to hook it up to an editor or IDE to analyse existing untyped js in this way it could be invaluable.