language: toward Obliq

Hans-Martin Mosner hm.mosner at cityweb.de
Sun Aug 30 18:50:47 UTC 1998


dufrp at oricom.ca wrote:
> ...
> Although that Cardelli is using a mathematical formalism that I don't
> really understand, I do have my way of understanding his ideas and I
> would summarize them in two ideas. First an objects is a bunch of
> fields, and this fields can all be changed. A field can be any value,
> including, and that what is new, a method value. So an object can
> modify his methods or add new ones.
> 
> Second idea: an object can be cloned. So rather than using classes the
> way we do with Smalltalk, we can create a function that clone a base
> object and return it.
> 
> This seems to give much more expressive power, and with it the
> possibility to make code that is much more harder to read and
> understand. Anyway my feeling is that it is worth it.
> 
This is actually a quite good description of the language Self, which
was inspired by Smalltalk. Self does both of the two ideas:
1. The slots of an object can contain methods or values. Accessing both
looks perfectly similar. If you imaging a Smalltalk where you access
every variable with a message send to self, and leave the 'self' out for
better readability, you get something very close to Self.
2. Self does not have classes but prototypes. That is, objects are not
made from descriptions of their structure but from examples.

Although I did not work with Self (it had/has a somewhat unesthetical
appetite for memory which made me unable to run it on any machine I
could get hold of at that time) I have some reservations about the
concept of prototype languages. The main thing is that I feel there
should be the 'platonic' difference between the concept of a thing and
the thing itself. Having the code of a class separate from any instances
makes me feel more secure in managing an manipulating this code.
Self seems to handle this problem with the introduction of 'traits'
objects which contain the behavior of a 'class' of objects. Instances
are typically not created by cloing this 'traits' object but a prototype
object which has the 'traits' object in a parent slot (a slot that's
used for method lookup in a hierarchy). This looks a lot like classes to
me... so even Self does not seem to be able to live without them.

Other people on the list can certainly say more things about Self, from
actual experience...

Hans-Martin





More information about the Squeak-dev mailing list