[squeak-dev] Re: On class/metaclass coupling

Andreas Raab andreas.raab at gmx.de
Tue Dec 8 16:16:41 UTC 2009


Igor Stasenko wrote:
> For people who think that we should not revise the class/metaclass
> coupling in Squeak,
> just ignore this topic and consider it as a rant :)
> 
> For those, who interested why i think its not a perfect from
> object-oriented point of view, continue reading.

It may help your thinking about the problem when you realize that the 
core coupling between object and class, is as simple as:

	Class new class == Class.

I.e., if you can implement the #class method you could do something like:

	FooClass>>class
		^FooFactory

	FooFactory>>new
		^FooClass new

This will work perfectly fine in terms of the "everyday use" of classes. 
I had thought about utilizing this to create "safe classes" that is 
classes that separate the factory / utility aspect from the vtable 
aspect (FooFactory can expose instance creation and utility methods 
without exposing the implemntation / compilation aspect provided by 
FooClass class').

Cheers,
   - Andreas




More information about the Squeak-dev mailing list