Copying
|
CopyingA running program usually creates lot of objects: things like points, collections and graphical widgets. In Self, these usually possess the same structure and behavior as existing objects, and are made by copying. The master object from which all objects of the same type are copied (directly or indirectly via another copy) is known as a prototype.Programming in a prototype-based language means creating a collection of prototypical objects with the desired structure and behavior, such that when the program is running new objects are created and interact with each other to achieve the desired overall effect. Each data type is represented, then, by a prototypical instance of that data type. For example, lists are represented by an empty list object. If we want a new list, we copy the prototypical list. A Self system has hundreds of prototypes. Here are the names of some:
point, list, sequence, byteVector, set, dictionary, unixFile, process, profiler, time, colorPickerMorph, debugger, paint, webBrowser... |