xxleyi / learning_list

聚集自己的学习笔记
10 stars 3 forks source link

JS 诞生之初的的故事 #253

Open xxleyi opened 3 years ago

xxleyi commented 3 years ago

https://brendaneich.com/2008/04/popularity/

在 JS 2008 年终于开始流行之后,Brendan Eich 亲自写了一篇博客,澄清一些问题。

关于 JS 比较相关的是:

I’m not proud, but I’m happy that I chose Scheme-ish first-class functions and Self-ish (albeit singular) prototypes as the main ingredients. The Java influences, especially y2k Date bugs but also the primitive vs. object distinction (e.g., string vs. String), were unfortunate.

We know certain Ajax libraries are popular. Is JavaScript popular? It’s hard to say. Some Ajax developers profess (and demonstrate) love for it. Yet many curse it, including me. I still think of it as a quickie love-child of C and Self. Dr. Johnson‘s words come to mind: “the part that is good is not original, and the part that is original is not good.”

所以总体来说,JS 是被明确且强制要求和 Java 保持相似度,但 Brendan Eich 加入了作为一级公民的函数,并引入原型继承机制。

现在来看,最影响整个 JS 生态的设计决策大概是加入作为一级公民的函数,独特的原型继承机制带来永恒的 this 问题,而自动封箱机制只是为了让领导层满意。