4 ms·
The main reason the comparison between JavaScript and Scheme is helpful is that it breaks the connection between JavaScript and Java. The first thing many Java
by EzGraphs 13y ago
The main reason the comparison between JavaScript and Scheme is helpful is that it breaks the connection between JavaScript and Java. The first thing many Java programmers do when trying to write JavaScript is to try to create a class hierarchy (rather than using prototypical inheritance) using idioms from Java. Although possible, it ends up awkward and confusing in most cases. Understanding that functions are first-class and seeing functional idioms fall out from there is a big paradigm shift for Java devs.
Obviously JavaScript isn't Scheme using the author's "top 10 defining characteristics of Scheme." Crockford's analysis is on track - and John Resig and Bear Bibeault highlight the same idea by introducing functions are really fundamental to the languages more than objects (in "Secrets of a JavaScript Ninja").
The language's history does imply the comparison as well. Eich's original mandate was to "write Scheme for the browser" but he was later directed to give his language a C-like syntax and to ride on the coat-tails of the hype surrounding Java.
"JavaScript isn't Scheme" might not be accurate for folks schooled in the finer points of Scheme. It is very useful to those who cut their teeth learning Java.
- dmpk2k 13y agoWe might just as well claim that Javascript is Perl then. Javascript has a lot more in common with Perl than it does Scheme; those things that both Javascript and Scheme have in common are also common in many other languages. Anyone trying to draw parallels between Javascript and Scheme isn't crossing some pedantic line, they're off in crazyland. Or, more likely, they don't understand both languages as well as they're implying.
- munificent 13y agoit breaks the connection between JavaScript and Java. This is a good point. The defining characteristic of Scheme in the minds of many is really just closures. Almost every modern language except Java has those, so "Scheme" has inadvertently turned into a weird shorthand for "inverse of Java". I think that's too blunt of an instrument to help you reason about any of the languages in question, but I do appreciate encouraging people to think functionally.