the monopoly of classes

Andreas Raab andreas.raab at gmx.de
Thu May 22 23:37:16 UTC 2003


> more precissely:
> 1. every object includes a field which contains a reference 
> to its "class object"
> 2. object Class includes a reference to its "class object" also

Well, actually the above is NOT precise but preciseness is besides the point
here. The question is "do all objects need to know their class or not"...

> my question is: do all objects really need to contain that field ?

... which is stated here. And the answer is: No, they don't. There is no
reason for this other than that it is hugely more efficient in terms of both
speed and space to do it that way.

Mind you it's called "object" oriented not "class oriented" (though many
people tend to forget it). "Object" oriented means that every object needs
to define some behavior. And one of the ways to do that is to observe that
"hey, many of these guys are essentially the same, so why not have a common
abstraction for it". And then someone said "hm ... maybe 'class' is a good
name for this abstraction?".

And surely, it is. But there is no requirement for an OO language to include
classes. Squeak just happens to do it that way. But many others OO languages
(including JavaScript) don't have any of these explicit common abstractions.

Cheers,
  - Andreas



More information about the Squeak-dev mailing list