-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support compile to asm.js #1234
Comments
See #375 |
@Ap0ph1s. ASM is hard. And it has a large number or restrictions. I wish it was that easy to just tell typescript to compile to it. But from what I've read, it seems better to write your code in C and then compile down to ASM. :| Just curious, for what do want to use ASM for, or is it more like you are writing ASM and want to use TypeScript to do it? |
Having an --asmjs option with the compiler would help to optimize TypeScript code for online games. |
Typescript to Haxe: https://github.com/jeremyfa/node-ts2hx |
Personally, I don't see much of a benefit of using TypeScript instead of JavaScript. Especially now that the ES6 standard also added class-based object-oriented programming to the language, all you'd really get from adopting TypeScript today would be the addition of static typing... and interfaces. Besides making your code look more like eg. Java code, I really don't see the benefit at all... except when using static typing to optimize the JavaScript code it produces... which is where asm.js comes in. In environments where high performance is essential (eg. 3D rendering in the browser for browser games or GIS web apps), the current approach is to write the core code (that does the heavy lifting) in C/C++ (compiled to asm.js) and everything else in JavaScript. That means you need a really good understanding of both JavaScript (which I do) and C/C++ (which I don't) to be able to write proper code or maintain existing code for such apps, both inside and outside of the the core code. How great would it be to be able to use one - TypeScript - codebase for such projects and compile to asm where possible and to regular JavaScript where not possible? Or to put it differently : how great would it be for a JavaScript programmer to be able to program in highly readable superset of JavaScript and have it compiled - where possible - to a highly optimized subset of JavaScript? It seems like a win-win for everyone, really, especially if you leave it optional whether or not to compile to asm.js for developers who don't work in high performance environments and prefer readability to performance. IMO, compilation of (a subset of) TypeScript to asm.js would be major improvement over TypeScript as it exists today. For me, it would totally be a game changer and make the difference between supporting and not supporting the adoptation of TypeScript at the company I work for... |
Those also interested in converting staticly typed variations of JavaScript to asm.js, WebAssembly or C might want to take a look at ThinScript, TurboScript or AssemblyScript. ThinScript compiles to JavaScript, WebAssembly, and C. TurboScript compiles only to JavaScript and WebAssembly. AssemblyScript compiles to WebAssembly only. Each of these languages have been inspired by TypeScript, and the latter is a subset of TypeScript. I'd like to thank @RReverser for pointing me in the direction of these languages. |
basically what was once here: http://typescript.codeplex.com/discussions/438243
Can it be done? :)))
The text was updated successfully, but these errors were encountered: