admin管理员组文章数量:1346668
I have always wondered why Douglas Crockford keeps paring JavaScript to Scheme. Yes JS was intended to be Scheme by its designer; but besides the first class function support and the lexical scoping (broken), what features does JS have in mon with Scheme that makes it "Lisp in C's Clothing"?
I have always wondered why Douglas Crockford keeps paring JavaScript to Scheme. Yes JS was intended to be Scheme by its designer; but besides the first class function support and the lexical scoping (broken), what features does JS have in mon with Scheme that makes it "Lisp in C's Clothing"?
Share Improve this question edited Mar 12, 2011 at 13:32 Yasir Arsanukayev 9,6862 gold badges42 silver badges62 bronze badges asked Mar 12, 2011 at 13:23 unj2unj2 53.6k90 gold badges252 silver badges380 bronze badges 5- Is there really a meaningful, definitive answer to this question? – Pointy Commented Mar 12, 2011 at 13:29
- 1 @Pointy: Yes any feature beside first class function and lexical scoping would be a meaninglful and definitive answer. Do you know of any? – unj2 Commented Mar 12, 2011 at 13:37
- 2 If you're wondering why Doug does something, why not send Doug an email? – Ken Commented Mar 12, 2011 at 15:42
- 3 @Ken : I didn't want to reply to such flippant reply but I want to point out that it is not about why Doug does what he does but if the thesis is a correct one and if you have a meaningful suggestion to take sides. – unj2 Commented Mar 12, 2011 at 17:53
- This blog post is probably relevant here. – rahmu Commented Jul 19, 2013 at 19:00
4 Answers
Reset to default 6Another thing that es to mind is the pervasive use of a single ubiquitous data structure throughout the language and the libraries: cons lists in the case of Scheme, maps (called objects) in the case of ECMAScript.
Then there is not just the fact that ECMAScript has first-class procedures, but that those procedures are the only abstraction mechanism. (Or more precisely encapsulation mechanism.)
One thing that should be high on this list is having a REPL. Seems like a technicality, especially when these repls are usually hidden behind some "developer tools" thing, but it has a huge effect on the language. (For example, it's natural to have a real eval
when there's a repl, etc.) It basically puts dynamic evaluation of code have first class status, which is extremely useful for something like JS, and probably has contributed much more to its success than first class functions (which really were hardly used until a few years ago).
Off the top of my head, plus glancing at Wikipedia:
- Block structure
- Runtime inspection
- Eval
- No (explicit) pilation step
- Small but rich stdlib
- Shared namespace for procedures and variables
Well, JavaScript lacks homoiconicity, and this is one of the main properties of Lisp dialects.
本文标签:
版权声明:本文标题:programming languages - Besides First Class Functions and Lexical Scoping, what does JavaScript share with Scheme implementation 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743827371a2545890.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论