Implementation Strategies for Object Orientation

非 Y 不嫁゛ 提交于 2019-12-05 02:51:53

Javascript is a prototype based implementation of an OO language.

Instead of subclassing a class and creating an instance of that new class, you inherit behaviour by cloning a prototype.

As a historical note I should add that while Javascript is probably the most widely used prototype-using language, the first was David Ungar's and Randall Smith's Self language.

There are several implementations of prototypes floating around for Squeak. I haven't used them, so I can't comment on the libraries.

I never saw, but read about Emerald, that is object-oriented but neither class- nor prototype-based but seems to construct objects "one by one" with the help of a special constructor:

However, Emerald objects do not require a Class object for their creation. In most object-based systems, the programmer first specifies a class object that defines the structure and behavior of all its instances. The class object also responds to new invocations to make new instances.

In contrast, an Emerald object is created by executing an object constructor. An object constructor is an Emerald expression that defines the representation, the operations, and the process of an object.

See Andrew Black, Norman Hutchinson, Eric Jul, and Henry Levy: "Object Structure in the Emerald System".

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!