Live data from Hacker News

Facebook Launches Flow, Static Type Checker for JavaScript

code.prod.facebook.com

211–220 of 282 posts

Re: Facebook Launches Flow, Static Type Checker for JavaScript

#211
post #143

Earlier quoted context omitted.

Read the Good Parts of Javascript and get a JS linter. Javascript is a fine language if you do this.

> Javascript is a fine language if you do this. No,it's not fine, it's a horrible language,with a few good features that saves it from being a catastrophy.hence "Good Parts". Or we wouldnt be here talking about Flow,Typescript or others if the language was "fine". JS was clearly not designed for what we are making out of it today. But since there is no way around Javascript in webdev,good or bad,it doesnt even matter…

Every language has good and bad parts.

Re: Facebook Launches Flow, Static Type Checker for JavaScript

#212
post #201
post #200

Earlier quoted context omitted.

Honest question: How different is a web worker from an actor?

Surprise answer: It's not. When people sat down and decided how workers are to act in browsers - Actors are what they had in mind. This is why Web Workers don't have access to the window scope, use explicit message passing etc.

So to reply to both of you:

Correct me please, but from what I understand web workers are not a part of the JavaScript language. The same way AJAX isn't a part of the JavaScript language. I would consider those (AJAX/WebWorkers) more like "system calls" to the browser. And like any system call, it has privileges the application doesn't.

Re: Facebook Launches Flow, Static Type Checker for JavaScript

#213
post #116

Earlier quoted context omitted.

"Java" which "compiles" to javascript is not Java. It's javascript with a ludicrous amount of syntactic sugar applied.

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…

Coming soon, JavaScript lambdas! What a novelty!

Re: Facebook Launches Flow, Static Type Checker for JavaScript

#214

What 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…

Is this a serious post, or are you being sarcastic? I honestly can't tell. JS the language of the future? Why? It has probably the worst gotchas of any language I've coded in, it's verbose, and weird scoping. Nor is it especially nice to optimize for/with. I can certainly see being stuck with Javascript (just like we're stuck with the x86 instruction set even if simpler alternatives exist), but I'm not sure it's some…

>JS the language of the future? Why? because it's pervasive. market matters, not developers.

Re: Facebook Launches Flow, Static Type Checker for JavaScript

#215
post #143

Earlier quoted context omitted.

> Javascript is a fine language if you do this. No,it's not fine, it's a horrible language,with a few good features that saves it from being a catastrophy.hence "Good Parts". Or we wouldnt be here talking about Flow,Typescript or others if the language was "fine". JS was clearly not designed for what we are making out of it today. But since there is no way around Javascript in webdev,good or bad,it doesnt even matter…

Every language has good and bad parts.

This can be used to justify any atrocity.

Re: Facebook Launches Flow, Static Type Checker for JavaScript

#216
post #136

Earlier quoted context omitted.

ES6 adds lambdas, destructing assignment, default/rest/ spread arguments and template strings - all of those reduce verbosity. And there is `let` which has a "normal" scope, although I'm not really sure it needs that. Additionally, generators let you use normal control flow constructs for IO, if you prefer that to FP. While its no Haskell, it certainly isn't much more verbose than other dynamic languages anymore. And…

a cryptographically secure pseudorandom number generator would be nice, too.

Server-side js has that already. On the clientside it would be useless.

Re: Facebook Launches Flow, Static Type Checker for JavaScript

#218
post #197

Earlier quoted context omitted.

May I ask why? Not having parallelism seems like a net negative to me...

[Edit] Before starting, I just want to state: I know JavaScript has parallelism/concurrency in its supporting "system calls" (ie what would, in other languages, be blocking calls, in both the browser or Node). In fact I like this parallelism model, but I was specifically talking about parallelism built into the language (Threads, Actors, Tasks). This is a long and complicated answer. I doubt I'll do it justice in a f…

Agreed. Rarely argued I think this is a very valid view. Additionally, some languages which have true parallelism are converging to the same model (say non-blocking IO ala Node), built on top of their crude parallelism primitives.

Re: Facebook Launches Flow, Static Type Checker for JavaScript

#219
post #174

Earlier quoted context omitted.

It's an opinionated book that sets out a subset of JavaScript that you should use, avoiding all the 'bad parts'. This subset is what tools like JSLint and JSHint were designed to promote - they flag you up if you use a bad part. It's a seminal work. These days I find some of its rules a little dogmatic (for instance I like the 'new' keyword now), but I'm glad I went through a phase of sticking to it relgiously for a…

But `new` is a bad part. Just an optimized bad part... You could replace every usage of it with `var instance = Object.create(Ctor.prototype);` (and change every `this` to `instance` in your code), and actually explicitly return `instance` -- and then never use `new` again. Your code will become more readable to boot, as there is less action at a distance.

Where is the action at a distance when I use new?

Re: Facebook Launches Flow, Static Type Checker for JavaScript

#220

This is HUGE! Thanks to everyone at Facebook who worked on this. You guys are awesome. Also: The fact that this is written primarily in OCaml (as opposed to JS) is an excellent example of people choosing the right tool for the job.

OCaml was used for implementation of the Opa framework some years ago https://github.com/MLstate/opalang
Post reply on HN