3 ms·
To be sure, the closer the two languages are, the less impedance mismatch there is. But no matter what, you brush up against the fact that when the languages a
by litewulf 18y ago
To be sure, the closer the two languages are, the less impedance mismatch there is.
But no matter what, you brush up against the fact that when the languages are just plain different, you have to be careful. And if you know Javascript is different from Language X, and can debug the difference, why are you writing Language X and not Javascript?
Honestly, most of what Lisp does that makes it unique (first class functions that aren't ugly, macros), are either availabe (first class functions), or something that the compiler can take care of for you, so it seems that Lisp is actually a scarily-good-fit for language to compile to JS. (Assuming no encountered bugs that is ;))
- gruseom 18y agoYes, that's right. And the macros go a long way. Actually, there is one big impedance mismatch: null. The semantics of Lisp and JS around null-zero-false are incompatible, and it leads to annoying bugs. I'm still looking for a good solution to that problem. The other big thing is that JS uses returns everywhere and Lisp doesn't. It might be possible to have the compiler add those in in the right places, but we haven't tried that yet.
- litewulf 18y ago(Actually, I just realized, JS has == semantics that are... kind of crazy. Do you write equals calls as a call to an equal method or just kind of keep it in mind?)
- gruseom 18y agoThe latter. And you're right, those == and === semantics are kind of crazy. But I think of that issue as more or less the same as the null-undefined-false-0 issue. Also, to answer your question: And if you know Javascript is different from Language X, and can debug the difference, why are you writing Language X and not Javascript? ... the answer, when X is Lisp, is that the benefit of the additional abstractive power is much greater than the cost of the impedance mismatch. Both sides of that equation would vary greatly depending on X, which is just a way of repeating what we've already discussed :)