[ANN] NeoSqueak v0.1 - explicit metaclass programming

Brent Pinkney Brent at astarte.co.nz
Fri Apr 14 00:48:48 UTC 2000


Hi all,

On http://minnow.cc.gatech.edu/squeak/400 there are references to Fred
Rivard and co's explicit metaclass programming model called NeoClassTalk. In
particular the paper on Safe Metaclass Programming available form the
NeoClassTalk homepage http://www.emn.fr/cs/object/tools/neoclasstalk/

This deals with the esoteric business of being able to change a class's
metaclass to something else to implement properties like Abtractness,
Singletons, etc.

As you know, in Squeak all metaclasses are an instance of the meta-metaclass
Metaclass and there is no way to change this.

I now have a very early implementation allowing for explicit metaclass
programming following the Compatibility Model described by Mssrs Rivard,
Saadani, and Ledoux. 

I implemented it in Squeak 2.7 under NT and got my first success this
morning !

To use:
1. Find an NT box.
2. Get the NT implementation of Squeak 2.7
3. Change the VM to the squeak.exe attached
4. File in the change set attached.

The change set introduces two new meta-metaclasses, PropertyMetaclass and
Abstract as subclasses of Metaclass. This is as per the Compatibility Model
specification.

The change set also introduces two test classes, Shape and Square.

The goal is to make Shape abstract without redifining Shape class>>#new.
Instead we wish to make 'Shape class' an instance of Abstract rather than an
instance of Metaclass.

In a workspace:

1. Execute: Shape new.
This will convince you that Shape is NOT abstract.

2. Execute: Abstract new composeWithPropertiesOf: Shape.

3. Execute: Shape new.
You should get an error complaining that 'Abstract classes cannot be
instanciated'.

4. Execute: Shape class.
This should convince you that the metaclass has changed to 'Abstract+Shape
class' and is an instace of Abstract, not Metaclass.

Implementation
--------------
The implementation introduced Object>>#class: and Class>>#class: to change
the metaclass of a class. This complements the existing Object>>#class
method. The functionality is implemented as a new primitive
#primitiveChangeClass which I assigned as number 570.

Discussion
----------
I only got this working this morning and admit to being terminally baffled
by meta-metalcasses. It is also the first contribution I have made to the
Squeak community, so be kind ;-)

The change set includes the code for the new primitive, so it should build
on any platform. PS. Thanks Andreas for the Windows source code. Compiled
first time.

Any feedback will be most appreciated especially any gitchas in the
primitive which I have no doubt missed. 

I am hoping to extend the implementation to fully implement the Compatibilty
Model and introduce more useful meta-metaclasses. 

Thanks
Brent Pinkney









More information about the Squeak-dev mailing list