Posts

Showing posts with the label typedjs

Google SoundScript: faster OOP for JavaScript

Update 2015-02-05: More information – “ Experimental New Directions for JavaScript ” by Andreas Rossberg (slides in English). Google is currently working on SoundScript , a way to speed up object-oriented programming in JavaScript. The content of this blog post is completely based on a recent talk [1] by Dmitry Lomov. That is, everything I have written here is inferred from those slides and may or may not be correct. Note: This blog post describes first ideas, avenues that Google is exploring for making JavaScript OOP faster. The final version of SoundScript may look and work completely different. Speeding up JavaScript JavaScript has already become quite fast. Additionally, Mozilla recently presented asm.js [3] as a way to compile static languages such as C++ to JavaScript. asm.js shares many traits with bytecode and achieves about 70% of native speed. asm.js is great for cross-compiling and for number crunching (e.g. a video codec), but it doesn’t help with more sophisticated Jav...

Try out Facebook’s Flow typechecker online

You can now try out Flow [1] , Facebook’s typechecker for JavaScript, online, at tryflow.org . The following example demonstrates Flow‘s power: function mul(x,y) { return x * y; } mul('a', 'b'); // static error The last line produces a static (“compile time”) error, because Flow infers the signature: function mul(x : number, y : number) : number In contrast, TypeScript infers the following signature (which you can check in the TypeScript Playground ): function mul(x : any, y : any) : number Further reading: Statically typed JavaScript via Microsoft TypeScript, Facebook Flow and Google AtScript

Statically typed JavaScript via Microsoft TypeScript, Facebook Flow and Google AtScript

Update 2014-11-18: Facebook Flow has been released as open source. Its website is flowtype.org . The site mentions plans for Flow’s future . This blog post looks at three initiatives for adding static typing to JavaScript: Microsoft’s TypeScript, Facebook’s Flow and Google’s AtScript. Typing Let’s first clarify some terminology related to typing (excerpted from “ Speaking JavaScript ”). Static versus dynamic In the context of language semantics and type systems, static usually means “at compile time” or “without running a program,” while dynamic means “at runtime.” Static typing versus dynamic typing In a statically typed language, variables, parameters, and members of objects (JavaScript calls them properties) have types that the compiler knows at compile time. The compiler can use that information to perform type checks and to optimize the compiled code. Even in statically typed languages, a variable also has a dynamic type, the type of the variable’s value at a given point at run...