前言
For nearly a decade within Bell Laboratories, I labored at implementing C++. First it was on cfront, Bjarne Stroustrup's original C++ implementation (from Release 1.1 back in 1986 through Release 3.0, made available in September 1991). Then it was on what became known internally as the Simplifier, the C++ Object Model component of the Foundation project. It was during the Simplifier's design period that I conceived of and began working on this book.
十年可以磨一剑;《十年》可以爱一个人;而我,Stanley Lippman, 用十年的时间,在贝尔实验室攻克C++编译器。
刚开始我做的是cfront。这款编译器代表了Bjarne Stroustrup(你们一般称其为“C++之父”,我们当时的领导之一)最初的C++设计思想。我们从1986年的1.1发布版陆续干到最终的1991年9月的3.0发布版。
cfront项目结束后,我继而投身于研发一个内部称为Simplifier的组件。它是Foundation项目中的C++对象模型。正是在设计Simplifier期间,我开始酝酿并起草(conceived of and began working on)这本书。
What was the Foundation project? Under Bjarne's leadership, a small group of us within Bell Laboratories was exploring solutions to the problems of large-scale programming using C++. The Foundation was an effort to define a new development model for the construction of large systems (again, using C++ only; we weren't providing a multilingual solution). It was an exciting project, both for the work we were doing and for the people doing the work: Bjarne, Andy Koenig, Rob Murray, Martin Carroll, Judy Ward, Steve Buroff, Peter Juhl, and myself. Barbara Moo was supervising the gang of us other than Bjarne and Andy. Barbara used to say that managing a software group was like herding a pride of cats.
地球人也许会好奇,Foundation项目在做些什么工作呢?在Bjarne班长的带领下,我们一群小伙伴在贝尔实验室里研究怎样让C++具备广泛的适用性,从而可以应用于大型(large-scale)编程开发中。Foundation项目致力于确立(define)一种新的构建大型系统的开发模式。再次说明,我们只使用C++,并不提供其他语言的解决方案。
这个项目屌炸天。令人激动的不仅是项目所做的工作本身,也包括参与其中的大牛:Bjarne, Andy Koenig, Rob Murray, Martin Carroll, Judy Ward, Steve Buroff, Peter Juhl, 当然还有我;)。Barbara Moo负责管理这群小伙伴,除了Bjarne和Andy(这俩特权分子:p)。Barbara常说管理这个团队"真让本宫操碎了心"(like herding a pride of cats)。
We thought of the Foundation as a kernel upon which others would layer an actual development environment for users, tailoring it to a UNIX or Smalltalk model as desired. Internally, we called it Grail, as in the quest for, etc. (It seems a Bell Laboratories tradition to mock one's most serious intentions.)
我们把Foundation视为一个内核。这样开发人员就能把一个开发环境搭建在这个内核之上,并能对这个内核进行适当裁剪(tailor)从而匹配UNIX或SmallTalk的数据模型。我们内部把Foundation比作我们一直在追寻的(as in the quest for)耶稣的圣杯(Grail)。贝尔实验室的光荣传统就是拿严肃的意图开涮(It seems a Bell Laboratories tradition to mock one's most serious intentions)。
Grail provided for a persistent, semantic-based representation of the program using an object-oriented hierarchy Rob Murray developed and named ALF. Within Grail, the traditional compiler was factored into separate executables. The parser built up the ALF representation. Each of the other components (type checking, simplification, and code generation) and any tools, such as a browser, operated on (and possibly augmented) a centrally stored ALF representation of the program. The Simplifier is the part of the compiler between type checking and code generation. (Bjarne came up with the name Simplifier; it is a phase of the original cfront implementation.)
Rob Murray提出了面向对象模型并将之命名为ALF。Foundation可创建持久耐用的基于语义的面向对象的应用程序实体。我们使用Foundation把传统的编译器部分抽出,放在了一些专属可执行文件中。语法解析器构建了当前应用程序的符合面向对象模型的ALF层级结构。其他的组件(包括类型检查器、简化器、代码生成器等)以及一些工具(例如浏览器)会对应用程序的这个创建好并被集中存放(stored centrally)的ALF实体执行相关操作。简化器在类型检查和代码生成之间的阶段工作。Bjarne将它命名为Simplifier;它是最初的cfront编译器的一个重要组成部分。