[squeak-dev] Re: Instance variable access in superclasses.

Igor Stasenko siguctua at gmail.com
Wed Nov 26 08:48:30 UTC 2008


2008/11/26 Trygve Reenskaug <trygver at ifi.uio.no>:
>
>
> On 26.11.2008 05:32, Igor Stasenko wrote:
>
> Of course i know it. Just a small(talk) correction: classes are
> objects as well and having state as well.
>
>
> >From "The Early History of Smalltalk" by Alan Kay
>
> 1. Everything is an object
> 2. Objects communicate by sending and receiving messages (in terms of
> objects)
> 3. Objects has their own memory (in terms of objects)
> ----
> 4. Every object is an instance of class (which must be an object)
> 5. The class holds the shared behavior for its instances (in the form
> of objects in a program list)
> 6. To eval a program list, control is passed to the first object and
> the remainder is treated as its message
>
> so, where in these statements you find anything about inheritance, or
> something where it says that subclass(es) should have any assumptions
> about the ways how superclass is storing its instances in memory, and
> therefore a subclass allowed to directly manipulate the object's state
> without consulting with superclass?
>
>
>
> I'm afraid Alan wasn't as precise as he should have been here.

I think he did this intentionally, because a precise parts is up to
implementation.
The principles above is most generic ones. Btw, notice a line between
3 and 4, its not just a random stroke - its actually shows a first
step from most generic to more specific.

> In a Squeak image, everything *IS REPRESENTED* by an object. I represent a cat by an
> object,  but that doesn't magically transform the purring cat into a Squeak
> object. I *REPRESENT* a class by an object, but it is confusing the issue to
> remove the distinction between the essence of a class and its representation
> as an object. Many a discussion has gone astray through this confusion.

To be fair , i was confused at first time , trying to understand how
basic class structure is defined and what connection between
Object, Behavior, Class and Metaclass. Still, i wrote a bootstrap code
in a few days, and it worked :)
Its hard to express such structure in words. But if you doing it step
by step - its not that hard.

>From VM's point of view: a class is a structure which holds a method
dictionary in one of its slots, so VM could perform method lookup.
Yes, its quite special entity, and you can't freely change it. But
this not makes it a less object than anything else. Its just another
kind of specialization :)

> (Have you ever heard anyone say "class A send a message to class B" when
> they mean "an instance of class A send a message to an instance of class B"?
> )

Never heard of it. People who saying like this, either don't
understand how message passing working , or its just a phrase taken
out from context, where everyone understand that speaker having
something concrete (instances or class objects themselves) in mind.
I can imagine smalltalk without inheritance, and even without classes
(in Squeak's form). But not without message passing.

>
> --Trygve
> --
>
> Trygve Reenskaug       mailto: trygver at ifi.uio.no
>
> Morgedalsvn. 5A         http://heim.ifi.uio.no/~trygver
>
> N-0378 Oslo               Tel: (+47) 22 49 57 27
>
> Norway
>
>

-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list