Description
Self objects are a collection of "slots". Slots are accessor methods that return values, and placing a colon after the name of a slot sets the value. For example, for a slot called "name",
myPerson name
returns the value in name, and
myPerson name:'foo'
sets it.
Self, like Smalltalk, uses blocks for flow control and other duties. Methods are objects containing code in addition to slots (which they use for arguments and temporary values), and can be placed in a Self slot just like any other object: a number for example. The syntax remains the same in either case.
Note that there is no distinction in Self between fields and methods: everything is a slot. Since accessing slots via messages forms the majority of the syntax in Self, many messages are sent to "self", and the "self" can be left off (hence the name).
Read more about this topic: Self (programming Language)
Famous quotes containing the word description:
“Whose are the truly labored sentences? From the weak and flimsy periods of the politician and literary man, we are glad to turn even to the description of work, the simple record of the months labor in the farmers almanac, to restore our tone and spirits.”
—Henry David Thoreau (18171862)
“A sound mind in a sound body, is a short, but full description of a happy state in this World: he that has these two, has little more to wish for; and he that wants either of them, will be little the better for anything else.”
—John Locke (16321704)
“It is possibleindeed possible even according to the old conception of logicto give in advance a description of all true logical propositions. Hence there can never be surprises in logic.”
—Ludwig Wittgenstein (18891951)