最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

programming languages - Besides First Class Functions and Lexical Scoping, what does JavaScript share with Scheme implementation

programmeradmin4浏览0评论

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
Add a ment  | 

4 Answers 4

Reset to default 6

Another 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.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论