3 ms·
> It produces readable javascript that is reasonably debuggable The examples on the page don't seem readable and reasonably debuggable to me. The simple square
by epidemian 14y ago
> It produces readable javascript that is reasonably debuggable
The examples on the page don't seem readable and reasonably debuggable to me. The simple square definition:
square x = x * x
Compiles into:
var square = function($_a) {
return new $(function() {
var x = $_a;
return _(x) * _(x);
});
};
Which, in turn, has all the "$" and "_" indirections.
This is basically why i think that trans-compilation to JS from a semantically very different language is not a good idea, unless a way of debugging _in the source language_ is provided. The success of CoffeeScript, i think, comes from it not differing too much from JS semantically; yes, it adds things like classes or everything-is-an-expression semantics, but the step of trans-compiling those things into JS is pretty trivial.
I hope the advent of source maps will help in the ease of use of these languages.
- sic1 14y agoI could not agree more with all your points. Source maps are the key, and i look forward to them very much. I am a coffeescripter, and i already have mixed emotions about the extra layer of complexity it puts on my code for others to get up to speed. Taking it further from the actual language (javascript) just adds a layer of obfuscation that does not really help javascript and its community at all (and many of the times your peers). It may make you feel better about what you are doing at the time (e.g. i must have typed vars, or whatever you people say), but its just making you feel better, it still is javascript, and you still have to debug javascript across browsers - that's just that. You still need to know all the javascript, you cant just use X to js and only know X. Only reason i get away with coffeescript is when i know im modern browser world, not old ie and the greater world of browser bugs. Otherwise im writing javascript.