一句话:用 Id 对象模型统一刻画 Smalltalk 与 Self 的方法绑定语义,并将二者视为不同特例。
Smalltalk 和 Self 分别是基于类和基于原型的晚绑定面向对象编程的典型代表。它们之间许多异同可归结为消息名如何绑定到具体值,但这些细节往往微妙且缺乏简洁描述。本文以 Id 对象模型为共同基础:该模型抽象了具体绑定语义,甚至允许把晚绑定消息发送纳入绑定语义中。作者据此给出 Smalltalk 与 Self 的方法绑定语义,并将二者刻画为 Id 对象模型中的不同特例,从而提供一种简洁、可比较的语义表述,揭示两种晚绑定 OOP 系统在绑定机制上的共性与差异。
Smalltalk and Self are two paradigmatic examples of class-based and prototype-based late-bound object-oriented programming, respectively. Many of their similarities and differences can be grounded in how they bind message names to concrete values, but the details can be subtle and are not available in a concise form. The Id object model abstracts over specific binding semantics, even permitting the flexibility of late-bound message sending as part of binding semantics, so it is worth using as a common basis on which to compare them. In this paper, we present the method-binding semantics of Smalltalk and Self as different “special cases” within the Id object model.