是誰讓JavaScript像Java的?
首先了解一下JavaScript的歷史,下面的一段對話引用并翻譯自infoworld對Brendan Eich的采訪:
InfoWorld: 據(jù)我了解,JavaScript最初名為Mocha,然后成了LiveScript,在Netscape和Sun聯(lián)合時(shí)被改名為JavaScript.但它實(shí)際上和Java沒有任何關(guān)系,或者說關(guān)系不大,我說的對嗎?
Eich: 你說的很對.在1995年的5月份到12月份的六個(gè)月內(nèi),JavaScript的名字先后從Mocha到LiveScript再到JavaScript.在12月份上旬,Netscape和Sun簽訂了許可協(xié)議,讓LiveScript改名成為JavaScript.其想法就是想讓JavaScript成為一門與Java這門編譯語言互補(bǔ)的腳本語言. |
Brendan Eich非常多次的表示,是當(dāng)時(shí)網(wǎng)景的某個(gè)管理人員讓他把JavaScript設(shè)計(jì)的像Java,下面列舉幾個(gè)出處:
1. 引用并翻譯自http://brendaneich.com/2008/04/popularity/
是使用一門已有的語言,還是發(fā)明一門新的語言,這也不是我能決定的.來自高層管理人員的強(qiáng)制命令是這門語言必須"看起來像Java".這樣也就排除了已有的語言Perl,Python,和Tcl,以及Scheme.后來,在1996年,John Ousterhout在給Tk做宣傳時(shí)還感嘆道,Tcl錯過了這樣一個(gè)很好的機(jī)會. |
2.引用自http://www.slideshare.net/BrendanEich/splash-9915475
Engineering VP的VP是vice president,工程副總裁的意思.從這句話可以看出,連JavaScript之父自己都不愿意承認(rèn)JavaScript像Java,我個(gè)人認(rèn)為,JavaScript像Java的地方只是一些表層的語法比如try catch,一些保留字,比如super,package,一些API,比如Date和Math.這些許許多多的表層語法堆砌起來讓JavaScript看起來像Java,只是像,但真正核心的語言特性是來自其他語言的.
在Jamie Zawinski(這個(gè)人一定要了解一下)的博客回復(fù)中,Brendan Eich還表示,如果他在十天內(nèi)做不出JS,會產(chǎn)生另外一種更糟的語言:
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所作的序.
這一點(diǎn)是眾所周知的,我在1995年5月用十天時(shí)間創(chuàng)建了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之后.
不過好奇的不只我一個(gè)人,有人在Quora提了這個(gè)問題: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并沒有直接說到底哪位管理者下的這個(gè)命令,只是給了一些提示讓提問者自己猜測,最關(guān)鍵的是,他還給出了當(dāng)時(shí)網(wǎng)景的管理團(tuán)隊(duì)名單.
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. |
其中有可能的只有兩個(gè)人,一個(gè)是Mike Homer,市場營銷副總裁.我一開始以為是他,搞市場的嘛.再看下面的這個(gè),Rick Schell,vice president of engineering(工程副總裁),這不正是上面PPT里說的VP嗎,那就是他了,Rick Schell.
了解JavaScript的歷史不見得有多有用,很的確很有趣,另外,我對Brendan Eich本人的經(jīng)歷也比較感興趣,下面大概翻譯一段他的自述:
我到網(wǎng)景本來是要做一個(gè)瀏覽器中的Scheme的,管理者給過這樣的承諾,這就像一個(gè)誘餌,結(jié)果我來了之后,管理者改變了主意. 我從大學(xué)期間就開始研究編程語言的實(shí)現(xiàn),僅僅為了好玩.在我工作生涯的早期,我為SGI公司寫過一個(gè)數(shù)據(jù)包嗅探工具.我是強(qiáng)烈的C/Unix迷.我從底層了解C的核心語法.網(wǎng)景讓我來實(shí)現(xiàn)JavaScript,僅僅是因?yàn)槲腋傻谋容^快,如果給更充分的時(shí)間,許多人都可以比我做的更好,或者即使和我一樣沒有足夠的時(shí)間,也能比我做的更好,誰知道呢?但在當(dāng)時(shí)的網(wǎng)景,沒有人能夠做到,那機(jī)會就是我的了.
原文鏈接:http://www.cnblogs.com/ziyunfei/archive/2012/12/17/2821077.html