Can compile-to-JavaScript tools be used for "regular" client-side development?

71 views Asked by At

In relation to this stack overflow question, I'm wondering what the typical use-cases are for compile-to-JavaScript tools. I've done some research and I've found a list of programming languages that compile to JavaScript, many of which are strongly-typed.

Emscripted and ASM.JS are typically used for for processor intensive tasks. Is this the primary use case of such tools, or is this dependent on the tool?

3

There are 3 answers

0
basarat On

Can compile-to-JavaScript tools be used for “regular” client-side development?

Coffeescript / TypeScript -> Yes. In fact that is on of their main target audience.

Asm.js -> Depends on how you define regular. If creating a quake clone in the browser is regular for you then yes. If creating a standard SPA (angular/react/ember etc) is regular then no, asm.js is not targetted at you

0
NoBugs On

I think most or all of those "languages that compile to JS" don't have anything to do with ASM.JS. ASM.JS is a very limited subset of JS that only runs assembly-style commands on a block of memory.

The main reason for doing so is performance, yes, since you can't directly access DOM and other handy browser objects directly.

0
arafeek On

For the most part it is dependent on the tool. Libraries such as asm.js offer low-level complex functionality and enhancements that most people would not be able to implement themselves. This is the basis for most libraries, it brings the saying "Standing on the shoulders of giants" to mind. CoffeeScript and TypeScript are dialects of JavaScript that offer people the option of writing in a language that has features they are accustomed to in other languages (like static typing). They can then compile their CoffeeScript code to JavaScript for use in a web browser. I hope this gave some insight into your question.