27 points · by e1ven · 19y ago · 15 comments
On the surface this seems less cool, but it has advantages that would be hard to achieve with a full Lisp->JS compiler. The generated JS is very efficient. Plus, it's very readable, so you can use all the standard tools for debugging etc. These things are critical for application development, which is why you see full compilers pop up more in the research world and not so much in business.
What are the advantages? Your code is higher-level, so it's clearer and shorter. You get to do most of your work (client- and server-side) in a single powerful environment. JS has become your assembly language, so you can make it low-level and efficient. This is the way out of the tradeoff between abstraction and performance in the browser. (We found that the higher-level JS libraries and frameworks are too slow because they make you pay for all that abstraction at runtime in the browser.) Oh, and it's easy to do code transformations: we wrote a profiler in about 50 lines of Lisp that works much like Firebug's but runs in all browsers.
Another advantage is that you can compile a different version for each browser that you support (no more client-side browser detection). It turns out, though, that browser incompatibilities go way down once you eschew complexity in the browser. Low-level and simple things are much more likely to work the same in different browsers than fancy stuff with CSS or tables.
This does nothing to abstract away all the nastiness of dealing with browsers. For example, from their introduction, you end up with stuff like this:
(html-stream *standard-output*
(html
(:html
(:head
(css (* :border "1px solid black")
(div.bl0rg :font-family "serif")
(("a:active" "a:hoover") :color "black" :size "200%"))))))Still, let's not get into an argument, I'd rather trade thoughts. The idea of abstracting away from the browser entirely seems attractive, but turns out to be impractical once you get to know the problem better. It's like abstracting away the network. So for me it's become clear that there's no way to get away from the browser altogether (except by not building HTML-based apps in the first place). That doesn't mean we can't significantly improve matters by building appropriate abstractions. As I said, we can reduce duplication, increase clarity and efficiency, and so on. The environment I'm describing has provided more of these benefits than anything else I've seen so far.
Re Joel Spolsky, I find most of his stuff tiresome and overblown, but he occasionally comes out with a great idea. What specifically did he say that you find relevant?