是谁让JavaScript像Java的?
首先了解一下JavaScript的历史,下面的一段对话引用并翻译自infoworld对Brendan Eich的采访:
InfoWorld: 据我了解,JavaScript最初名为Mocha,然后成了LiveScript,在Netscape和Sun联合时被改名为JavaScript.但它实际上和Java没有任何关系,或者说关系不大,我说的对吗? Eich: 你说的很对.在1995年的5月份到12月份的六个月内,JavaScript的名字先后从Mocha到LiveScript再到JavaScript.在12月份上旬,Netscape和Sun签订了许可协议,让LiveScript改名成为JavaScript.其想法就是想让JavaScript成为一门与Java这门编译语言互补的脚本语言. |
Brendan Eich非常多次的表示,是当时网景的某个管理人员让他把JavaScript设计的像Java,下面列举几个出处:
1. 引用并翻译自http://brendaneich.com/2008/04/popularity/
是使用一门已有的语言,还是发明一门新的语言,这也不是我能决定的.来自高层管理人员的强制命令是这门语言必须"看起来像Java".这样也就排除了已有的语言Perl,Python,和Tcl,以及Scheme.后来,在1996年,John Ousterhout在给Tk做宣传时还感叹道,Tcl错过了这样一个很好的机会. |
2.引用自http://www.slideshare.net/BrendanEich/splash-9915475
Engineering VP的VP是vice president,工程副总裁的意思.从这句话可以看出,连JavaScript之父自己都不愿意承认JavaScript像Java,我个人认为,JavaScript像Java的地方只是一些表层的语法比如try catch,一些保留字,比如super,package,一些API,比如Date和Math.这些许许多多的表层语法堆砌起来让JavaScript看起来像Java,只是像,但真正核心的语言特性是来自其他语言的.
在Jamie Zawinski(这个人一定要了解一下)的博客回复中,Brendan Eich还表示,如果他在十天内做不出JS,会产生另外一种更糟的语言:
JS had to "look like Java" only less so, be Java's dumb kid brother or boy-hostage sidekick. Plus, I had to be done in ten days or something worse than JS would have happened. |
3.引用并翻译自Brendan Eich给David Herman的新书Effective JavaScript所作的序.
这一点是众所周知的,我在1995年5月用十天时间创建了JavaScript,在管理者这样的胁迫和压力之下:“make it look like Java,” “make it easy for beginners,” “make it control almost everything in the Netscape browser.” |
Brendan Eich的确非常多次的说过这句话:"make it look like Java".我每次看到这句话,都很好奇,到底是哪位管理人员这样要求的呢.尤其是在看过Code Rush之后.
不过好奇的不只我一个人,有人在Quora提了这个问题:Who was the manager at Netscape, that insisted on making JavaScript look like Java?
Rick Waldron在推特上告诉了Brendan Eich,Brendan Eich亲自去回答了一下:
It was not one manager. I've always said "management". You can infer "technical", so not Jim Barksdale. You should include executives not directly in my chain of command. The Netscape org chart of that era is well-known so I will leave the rest as an exercise. Nothing here was particularly misguided. Remember how big Java was going to be? "Java + Netscape kills Windows" -- who said that? It was a time.... /be |
Brendan Eich并没有直接说到底哪位管理者下的这个命令,只是给了一些提示让提问者自己猜测,最关键的是,他还给出了当时网景的管理团队名单.
Mike Homer, vice president of marketing. Prior to joining Netscape in October 1994, Homer served as vice president of engineering at EO Corporation (from 1993) and vice president of marketing at GO Corporation (from 1991 to 1993). Before that, he worked at Apple Computer for nine years in a variety of technical and marketing positions. Rick Schell, vice president of engineering. Dr. Schell, who joined Netscape in October 1994, previously spent more than two years as vice president/general manager of the Central Point Division of Symantec Corporation. Prior to that, he served as vice president, languages and dBase, at Borland International from 1989 to 1993. He also held a variety of management positions at Sun Microsystems and Intel Corporation. |
其中有可能的只有两个人,一个是Mike Homer,市场营销副总裁.我一开始以为是他,搞市场的嘛.再看下面的这个,Rick Schell,vice president of engineering(工程副总裁),这不正是上面PPT里说的VP吗,那就是他了,Rick Schell.
了解JavaScript的历史不见得有多有用,很的确很有趣,另外,我对Brendan Eich本人的经历也比较感兴趣,下面大概翻译一段他的自述: