Compile To JS
But it did get me thinking about what it would take for me to use a compile to js language.
I think the only reason to use a higher level language is that it uses more abstract metaphors to simplify underlying concepts. For me, syntax is an aesthetic thing, and although I care deeply about the beauty of the code I write, syntax alone does not determine a language's efficacy.*
So what would a language need to replace js for me? And what would be nice to have?
1. Improved abstraction around inheritance
A language that had a clearer model could do well here. I don't think that the syntax changes put forward by coffeescript, or even ES.next go far enough.
2. Improved efficiency
The only way to make a computer faster is to make it do less. The various JS interpreters are already incredible pieces of technology, but a compile to js language would have the ability to improve efficiency.
The reason higher level languages can be made faster is that they are a representation closer to what a programmer is trying to do, and further from how they are trying to do it. Behind the scenes, all sorts of magic can be used to collapse that down into less work for the computer.
3. Optimise for a platform
Isaacs touched on this in his post, but high level languages usually can be compiled to a target platform. While coffeescript tries to remain interchangeable with js, and thus has to compile to all platforms, a higher level language could be targeted to an interpreter, thus you could tailor a version to the v8 engine and have it run faster in node.js. You could then compile it to good browsers which would tailor it to standards compliant browsers.
This would be nice, especially if DOM inconsistencies were taken care of in the browser environments, because a huge amount of time in web programming is spent dealing with browser differences, it would be amazing to make this a compiler problem.
4. Better Number Support
5. Abstraction Libraries for Web Constructs
Many of the things that are now available to us in the browser were written with the constraints of the web foremost, and the usability of, second. Things like web workers, or IndexedDB are extremely powerful, but require a certain level of forethought. It would be awesome to be able to delegate callbacks to a web worker on the fly, for example. A high level language could do interesting things here.
So Much More...
In fact, as I started writing, there's a lot of things off the top of my head that a higher level language could address - those were just the first 5 I thought of.
Now some people may argue that some of these are being addressed in ES.next or in the browsers - but we are going to have to support older browsers for a while. Perhaps someone will write a compiler for ES.next to transcribe it into old js so that new code can be run in older browsers also.