4 ms·
I note that doesn't read 'good JS' or 'fast JS'. You can put me in a tutu but I won't be a prima ballerina.
by msy 16y ago
I note that doesn't read 'good JS' or 'fast JS'. You can put me in a tutu but I won't be a prima ballerina.
- Zak 16y agoDefine good in this context. I'm inclined to say that if it doesn't have cross-browser bugs and it's fast, then it's good. The output being readable to human programmers probably shouldn't be a goal when JS is being used as a compiler target.
- msy 16y agoI'd define good as it takes full advantage of the javascript language and produces & can be used to create structures optimised for javascript, not the language it was written in.
- stcredzero 16y agoThis is why I think it's better to reduce the context-switch between server and browser and not eliminate it. There's going to be a context-switch there no matter what you do, so there's no sense in paying such high prices to try to eliminate it.
- gruseom 16y agoAgreed in principle, but readability still matters a great deal for debugging. There's vastly more browser tool support for JS (e.g. Firebug) than for languages targeting JS. These tools get harder to take advantage of as one's compiled JS gets less readable. Sometimes I think the holy grail for what we do would be a Slime-like REPL in the web browser that speaks Parenscript, maps to source code, and had full debugging support. In the meantime, though, things like Firebug are indispensable.
- sedachv 16y ago"The output being readable to human programmers probably shouldn't be a goal when JS is being used as a compiler target." Everyone says that until they have to debug the generated JavaScript in IE.
- sjs 16y agoI'm not sure about all of them but CoffeeScript emits good, portable, fast JS.
- msy 16y agoCoffeescript I'm familiar with and yes, is very nice indeed. It's some of the others I'd be more concerned about.
- stcredzero 16y agoIf we can enable source pointers for debugging, then "good" matters less -- about as much as how "good" x86 ISA is.
- chc 16y agoCoffeeScript is largely an alternate syntax to JS with a couple of macros added on. That's more like the prima ballerina changing from her pajamas into a tutu.
- sjs 16y agoIndeed, they don't go as far as some of the other ones, but it's still a language that compiles down to JS. It's nice that it's a strict superset of JS (iirc anyway) but that alone doesn't mean that it's impossible to produce slow or bloated JS. Of course any language that does a lot more than CS is going to be slower, e.g. Objective-J's object system providing method-missing functionality and a whack of other features not found natively in JS.