Facebook Launches Flow, Static Type Checker for JavaScript
181–190 of 282 posts
Re: Facebook Launches Flow, Static Type Checker for JavaScript
#182Earlier quoted context omitted.
All the language features of java: generics, inheritance, type safety, interfaces, and soon to come: lambdas and other Java 8 features, are all supported. Plus your code is organized in java packages. So, I'm not sure you've ever tried GWT. Things like multi threading which aren't possible in javascript aren't supported, but a lot of the JRE which is used in most code, does come out of the box. Its a huge improvement…
Those are features of the IDE, and of Java, certainly. But type safety doesn't really exist in javascript. Structures like interfaces and classes don't really exist. Inheritance is different. Scope is different. What you have is a javascript framework which emulates the behavior of Java to the degree that javascript permits, but can't really implement it. I'm not saying it isn't a useful tool, or that the javascript…
You know where else none of that exists? In the machine code on which the JVM rests and to which Java code can be JIT compiled by the JVM before execution.
So, if you can't have it compiling to JS, you never could have it on the JVM, either.
Re: Facebook Launches Flow, Static Type Checker for JavaScript
#183What a great tool. Facebook are absolutely killing with the last year or so with all of their open source contributions and releases. First HHVM, Haxl, React.js (amongst other things) and now Flow, this is fantastic. I am really liking how companies like Facebook & Google are concentrating their efforts on the web language of the future: Javascript. The support for JSX alone is a MASSIVE feature (expected given React…
Re: Facebook Launches Flow, Static Type Checker for JavaScript
#184Earlier quoted context omitted.
Those are features of the IDE, and of Java, certainly. But type safety doesn't really exist in javascript. Structures like interfaces and classes don't really exist. Inheritance is different. Scope is different. What you have is a javascript framework which emulates the behavior of Java to the degree that javascript permits, but can't really implement it. I'm not saying it isn't a useful tool, or that the javascript…
> But type safety doesn't really exist in javascript. Structures like interfaces and classes don't really exist. You know where else none of that exists? In the machine code on which the JVM rests and to which Java code can be JIT compiled by the JVM before execution. So, if you can't have it compiling to JS, you never could have it on the JVM, either.
Re: Facebook Launches Flow, Static Type Checker for JavaScript
#185Earlier quoted context omitted.
I don't think you're seeing my point. You may be coding java, but none of the tangible benefits of java over javascript actually translate, because you're actually writing javascript, with all of the warts and limitations and weirdness therein. The javascript exported will not be truly type safe, because javascript is not, and cannot be. It may appear to act like it, within the context of the code when run as predict…
Hmm, so assembly code doesn't have any type safety or high level features. So when I code in a higher level language I shouldn't be able to actually program in it because assembly doesn't support it, all I am doing is writing in a assembly framework and can't really do more than what it permits, right? What a load of crap and the op is down voted!!! You are writing java and barring some features like multi-threading,…
Javascript is not the equivalent of assembly. Javascript is, itself, a higher-level language. You're talking about translating from one high-level language to another, and expecting the interpreter for the latter to care anything about the rules of the former.
>What a load of crap and the op is down voted!!!
The entire thread is downvoted. It's annoying but it doesn't prove anything.
Re: Facebook Launches Flow, Static Type Checker for JavaScript
#186And on the side note, I bet Facebook did this just to make nerds install OCaml and show them the light :)
Re: Facebook Launches Flow, Static Type Checker for JavaScript
#187I wonder which will have the most impact: code quality or types as documentation (esp for tooling)?
They are adapting to common idioms, rather than designing it from the ground up. This ad hoc approach is a great way to build useful tools (and startups), but it's also usually a mess. Like NN4. But, they seem to be type experts - plus they're using ocaml. Maybe ad hoc by experts is the way to get these ideas adopted?
Re: Facebook Launches Flow, Static Type Checker for JavaScript
#188This looks like such a better step in the right direction than than the types of tools MS and Google have been putting out. Dynamically discerning the underlying code, and allowing optional type annotation works _with_ javascript, as opposed to attempting to turn js into a completely different (and weakened) language. That said, I am curious what solutions this solves that isn't already solved by enforcing good code…
> code intelligence, which aids code maintenance, navigation, transformation, and optimization
I suspect that for facebook, this could be just as important, if not more so, than code quality benefits.
Re: Facebook Launches Flow, Static Type Checker for JavaScript
#189This looks like such a better step in the right direction than than the types of tools MS and Google have been putting out. Dynamically discerning the underlying code, and allowing optional type annotation works _with_ javascript, as opposed to attempting to turn js into a completely different (and weakened) language. That said, I am curious what solutions this solves that isn't already solved by enforcing good code…
The Google Closure Compiler (https://developers.google.com/closure/compiler/) has been around for years and years.
It does everything you mentioned (100% optional type annotations, type inference), plus more (dead code removal, inlining, compiler-time constants).
Re: Facebook Launches Flow, Static Type Checker for JavaScript
#190It has static type checking with optional type annotations and type inference.
It doesn't have compiler-time constants, dead code removal, inlining, or other optimizations.
But....still really cool.