News for hackers. Stuff that matters.
Re:V8 release v6.8 by rptv on Thursday June 21, 2018 @09:09AM (#17364700)
I want to see something like Flow integrated into the js specs. Types can help optimization just as they can help correctness!
Re:V8 release v6.8 by rictic on Thursday June 21, 2018 @02:28PM (#17367972)
Possibly! But trickier than it seems at first.

For types to help with optimization, those types have to be correct and reliable (i.e. sound). If every line of your app and all of its dependencies are sound, then you should expect a speedup. If there is any unsound code, then you'll have to generate runtime checks to preserve the soundness properties that your optimizer assumes, and those can actually result in _slower_ code.

Even Flow has made compromises that are good for a type checker, but likely unacceptable if an optimizer is relying on them. Quoting https://flow.org/en/docs/lang/types-and-expressions/

> Soundness is fine as long as Flow isn’t being too noisy and preventing you from being productive. Sometimes when soundness would get in your way too much, Flow will favor completeness instead. There’s only a handful of cases where Flow does this.

Re:V8 release v6.8 by esturk on Friday June 22, 2018 @12:45AM (#17371390)
There are stuff that flow doesn't even handle such as inline destructure with types. Imagine how complicated it gets at the engine level of parsing the syntax.