是誰讓JavaScript像Java的?

紫雲飛發表於2013-01-09

來源:紫雲飛的部落格 (@紫雲妃

首先了解一下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

是誰讓JavaScript像Java的?

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本人的經歷也比較感興趣,下面大概翻譯一段他的自述:

我到網景本來是要做一個瀏覽器中的Scheme的,管理者給過這樣的承諾,這就像一個誘餌,結果我來了之後,管理者改變了主意. 我從大學期間就開始研究程式語言的實現,僅僅為了好玩.在我工作生涯的早期,我為SGI公司寫過一個資料包嗅探工具.我是強烈的C/Unix迷.我從底層瞭解C的核心語法.網景讓我來實現JavaScript,僅僅是因為我乾的比較快,如果給更充分的時間,許多人都可以比我做的更好,或者即使和我一樣沒有足夠的時間,也能比我做的更好,誰知道呢?但在當時的網景,沒有人能夠做到,那機會就是我的了.

相關文章