ANSI Smalltalk 和 Smalltalk-80 有什么区别?
我发现 ANSI Smalltalk 规范(草案)中没有提及 thisContext
。
我假设 ANSI Smalltalk 是标准化的 Smalltalk-80,所以我不明白为什么它不存在。他们有什么区别呢?
I discovered there is no mentioning about thisContext
in ANSI Smalltalk specification (draft).
I assumed ANSI Smalltalk as standardized Smalltalk-80, so I can't understand why it's not there. What's the difference of them?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Smalltalk-80 指的是一个非常具体的东西:1980 年 Xerox Parc 使用的 Smalltalk 版本。虽然有许多基于 Smalltalk 的版本,无论是直接意义上的(Squeak 和 Pharo)还是意识形态意义上的(Ambrai) Smalltalk 和 GNU Smalltalk),在那种环境下,目前还没有任何 Smalltalks 实际上完全遵循该书中描述的语言和虚拟机。即使是意识形态上最接近的 Squeak,也存在一些重大偏差:Squeak 有闭包,而 Smalltalk-80 没有; Squeak 有 Unicode,Smalltalk-80 没有; Squeak 的 VM 支持并使用命名原语,而 Smalltalk-80 则不支持; Squeak 支持一些 Smalltalk-80 不支持的字节码;等等。
ANSI Smalltalk 与 ANSI Common Lisp 一样,试图定义一个标准,该标准在主要 Smalltalk 实现中合并了 Smalltalk 功能的公共子集。由于 ANSI 标准于 1998 年编写,它必须考虑的不仅仅是最初的实现。特别是,当时的一些主要 Smalltalk,例如 Smalltalk MT 和 VisualAge Smalltalk,完全缺乏延续性(因此导致
thisContext
变量)。因此 ANSI 标准中不存在该功能。在实践中,这些差异有些学术性。您担心
thisContext
,但 GNU Smalltalk 有完全不同的语法,VisualWorks 有名称空间,Squeak 有 Traits,Pharo 缺乏 MVC...只是有更紧迫的差异。在 Smalltalk 的发展历程中,Smalltalk-80 和 ANSI Smalltalk 草案都是最重要的指导方针。Smalltalk-80 refers to a very specific thing: the version of Smalltalk that was in use at Xerox Parc back in 1980. While there are many Smalltalks that are based, either in a direct sense (Squeak and Pharo) or an ideological sense (Ambrai Smalltalk and GNU Smalltalk), on that environment, there are no Smalltalks around today that actually fully adhere to the language and virtual machine described in that book. Even Squeak, which is probably the closest ideologically, has some major deviations: Squeak has closures, Smalltalk-80 does not; Squeak has Unicode, Smalltalk-80 does not; Squeak's VM supports and uses named primitives, Smalltalk-80 does not; Squeak support some bytecodes that Smalltalk-80 does not; and so on.
ANSI Smalltalk, like ANSI Common Lisp, attempted to define a standard that incorporate a common subset of Smalltalk functionality across the major Smalltalk implementations. Since the ANSI standard was written in 1998, it had to take into account far more than just the original implementation. In particular, some at-the-time major Smalltalks, such as Smalltalk MT and VisualAge Smalltalk, lacked continuations entirely (and a
thisContext
variable as a result). That feature is therefore absent from the ANSI standard.In practice, these differences are somewhat academic. You're worried about
thisContext
, but GNU Smalltalk has a radically different syntax, VisualWorks has namespaces, Squeak has Traits, Pharo lacks MVC...there are simply more pressing differences. Smalltalk-80 and the ANSI Smalltalk draft are both more guidelines than anything else at this point in Smalltalk's life.