Andreas Raab uploaded a new version of Traits to project The Trunk:
http://source.squeak.org/trunk/Traits-ar.282.mcz==================== Summary ====================
Name: Traits-ar.282
Author: ar
Time: 5 March 2010, 9:11:40.384 pm
UUID: 12ff2e33-f431-6a40-b994-b00faab2062e
Ancestors: Traits-ar.281
Avoid dictionary protocol in Smalltalk.
=============== Diff against Traits-ar.281 ===============
Item was changed:
----- Method: Trait classSide>>convertClassToTrait: (in category 'load-unload') -----
convertClassToTrait: aClass
"Convert the given class to a trait"
| aTrait |
"Move the class out of the way"
+ aClass environment removeKey: aClass name.
- Smalltalk removeKey: aClass name.
"Create the trait in its place"
aTrait := Trait named: aClass name
uses: {}
category: aClass category.
aClass organization commentRemoteStr ifNotNil:[
aTrait classComment: aClass organization classComment
stamp: aClass organization commentStamp].
aClass selectorsAndMethodsDo:[:sel :meth|
aTrait compile: (aClass sourceCodeAt: sel)
classified: (aClass organization categoryOfElement: sel)
withStamp: (aClass compiledMethodAt: sel) timeStamp
notifying: nil].
aClass classSide selectorsAndMethodsDo:[:sel :meth|
aTrait classSide compile: (aClass classSide sourceCodeAt: sel)
classified: (aClass classSide organization categoryOfElement: sel)
withStamp: (aClass classSide compiledMethodAt: sel) timeStamp
notifying: nil].
aClass obsolete.
^aTrait
!
Item was changed:
----- Method: Trait classSide>>convertTraitToClass: (in category 'load-unload') -----
convertTraitToClass: aTrait
"Convert the given trait to a class"
| aClass |
"Move the trait out of the way"
+ aTrait environment removeKey: aTrait name.
- Smalltalk removeKey: aTrait name.
"Create the class in its place"
aClass := Object subclass: aTrait name
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: aTrait category.
aTrait organization commentRemoteStr ifNotNil:[
aClass classComment: aTrait organization classComment
stamp: aTrait organization commentStamp].
aTrait selectorsAndMethodsDo:[:sel :meth|
aClass compile: (aTrait sourceCodeAt: sel)
classified: (aTrait organization categoryOfElement: sel)
withStamp: (aTrait compiledMethodAt: sel) timeStamp
notifying: nil].
aTrait classSide selectorsAndMethodsDo:[:sel :meth|
aClass classSide compile: (aTrait classSide sourceCodeAt: sel)
classified: (aTrait classSide organization categoryOfElement: sel)
withStamp: (aTrait classSide compiledMethodAt: sel) timeStamp
notifying: nil].
aTrait obsolete.
^aClass
!