Packaging Traits ( RE: Two important issues... - on Issue 2 )

Brent Vukmer bvukmer at blackboard.com
Fri Feb 14 14:42:12 UTC 2003


The very first thing the Squeak community needs to accomplish with
Traits, IMO, is to help Nathanael create a Traits package that can be
installed in 3.4/3.5. Is anybody helping Nathanael with this?

According to
http://www.iam.unibe.ch/~schaerli/smalltalk/traits/traitsPrototype.htm#L
imitations, there are at least two problems that need to be solved:

(1) There is still no file-in/file-out for classes containing traits
(2) Filing in traits requires recompilation of the whole system, but the
Traits changes hit a problem with Metaclass/ClassBuilder

Andreas posted a detailed note to the list about the underlying causes
of the problem #2: 
http://lists.squeakfoundation.org/pipermail/squeak-dev/2003-February/051
832.html . 

Here is the relevant snippet:

> There's a single problem left at this point which is that you 
> can't recompile the entire class hierarchy - it will break at 
> Metaclass. This for two reasons. For one, Metaclass class is 
> an instance of Metaclass (e.g., "Metaclass class isMemberOf: 
> Metaclass" yields true) which means that when we convert the 
> _instances_ of Metaclass we also convert the _class_ of 
> Metaclass with possibly fatal consequences (and I have _no_ 
> idea why this has ever worked...) I think that just excluding 
> Metaclass' class from the update process should be enough 
> here but I'm not certain. The second problem with Metaclass 
> is that when you reshape Metaclass (e.g., creating 
> NewMetaclass) the meta class created for it (NewMetaclass 
> class) needs to be an instance of NewMetaclass for the same 
> reason. Not doing so will leave Metaclass with a broken 
> instance layout since after reshaping Metaclass its class 
> (Metaclass class) will still have the shape of OldMetaclass 
> (so to speak) while having the class pointer to NewMetaclass 
> (due to #become). I think that some creative use of a 
> "multiple new" (e.g., create NewMetaclass class <instance of: 
> OldMetaclass>, then create NewMetaclass <instanceOf: 
> NewMetaclass class>, then create NewMetaclass2 
> class<instanceOf: NewMetaclass>, then create <NewMetaclass2>) 
> should do the trick since the only thing that matters is that 
> the shape of both NewMetaclass and NewMetaclass class is 
> correct (everything else will fixed by #become later). 
> Alternatively, a well-placed #primitiveChangeClassTo: might 
> work miracles.



More information about the Squeak-dev mailing list