Andreas Raab uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ar.358.mcz
==================== Summary ====================
Name: Kernel-ar.358
Author: ar
Time: 30 December 2009, 3:25:44 am
UUID: 64524f19-7ed5-c447-b0e7-87b498e927c2
Ancestors: Kernel-ar.357
Some recategorization and removal of empty categories.
=============== Diff against Kernel-ar.356 ===============
Item was changed:
+ ----- Method: Behavior>>hash (in category 'comparing') -----
- ----- Method: Behavior>>hash (in category 'as yet unclassified') -----
hash
^ self name hash!
Item was added:
+ ----- Method: ClassDescription class>>initialize (in category 'class initialization') -----
+ initialize
+ "Do some reformatting of categories"
+ {
+ Behavior -> #(#'initialize-release' #accessing #'accessing class hierarchy' #'accessing instances and variables' #'accessing method dictionary' #testing #'testing class hierarchy' #'testing method dictionary' #comparing #'adding/removing methods' #compiling #enumerating #copying #'instance creation' #'obsolete subclasses' #printing #queries #'system startup' #'user interface' #private
+ ).
+ ClassDescription->#(#'initialize-release' #accessing #'accessing class hierarchy' #'accessing comment' #'accessing method dictionary' #'accessing parallel hierarchy' #compiling #copying #'fileIn/Out' #'instance variables' #organization #printing #private
+ ).
+ Class->#(#'initialize-release' #accessing #'accessing class hierarchy' #testing #'class name' #'class variables' #compiling #copying #'fileIn/Out' #'instance variables' #organization #'pool variables' #'subclass creation' #private
+ ).
+ Metaclass->#(#'initialize-release' #accessing #'accessing parallel hierarchy' #testing #'class hierarchy' #compiling #copying #enumerating #'fileIn/Out' #'instance creation' #'instance variables' #'pool variables' #private
+ ).
+ Behavior class->#(#'class initialization' #testing) .
+ ClassDescription class->#(#'class initialization' #traits) .
+ Class class->#(#'fileIn/Out' #'instance creation' #inquiries) .
+ Metaclass class->#(#'anti-corruption')
+ } do:[:assoc| | organizer categories |
+ organizer := assoc key organization.
+ categories := assoc value,
+ (organizer categories reject:[:cat| assoc value includes: cat]).
+ organizer categories: categories.
+ organizer removeEmptyCategories.
+ ].!
Item was changed:
+ ----- Method: Behavior>>obsolete (in category 'initialize-release') -----
- ----- Method: Behavior>>obsolete (in category 'initialization') -----
obsolete
"Invalidate and recycle local methods,
e.g., zap the method dictionary if can be done safely."
self canZapMethodDictionary
ifTrue: [self methodDict: self emptyMethodDictionary].!
Item was changed:
ClassDescription subclass: #Class
+ instanceVariableNames: 'subclasses name classPool sharedPools environment category'
- instanceVariableNames: 'subclasses name classPool sharedPools environment category traitComposition localSelectors'
classVariableNames: ''
poolDictionaries: ''
category: 'Kernel-Classes'!
!Class commentStamp: '<historical>' prior: 0!
I add a number of facilities to those in ClassDescription:
A set of all my subclasses (defined in ClassDescription, but only used here and below)
A name by which I can be found in a SystemDictionary
A classPool for class variables shared between this class and its metaclass
A list of sharedPools which probably should be supplanted by some better mechanism.
My instances describe the representation and behavior of objects. I add more comprehensive programming support facilities to the basic attributes of Behavior and the descriptive facilities of ClassDescription.
The slot 'subclasses' is a redundant structure. It is never used during execution, but is used by the development system to simplify or speed certain operations. !
Item was changed:
+ ----- Method: Behavior>>environment (in category 'accessing') -----
- ----- Method: Behavior>>environment (in category 'naming') -----
environment
"Return the environment in which the receiver is visible"
^Smalltalk!
Item was changed:
ClassDescription subclass: #Metaclass
+ instanceVariableNames: 'thisClass'
- instanceVariableNames: 'thisClass traitComposition localSelectors'
classVariableNames: ''
poolDictionaries: ''
category: 'Kernel-Classes'!
!Metaclass commentStamp: '<historical>' prior: 0!
My instances add instance-specific behavior to various class-describing objects in the system. This typically includes messages for initializing class variables and instance creation messages particular to a class. There is only one instance of a particular Metaclass, namely the class which is being described. A Metaclass shares the class variables of its instance.
[Subtle] In general, the superclass hierarchy for metaclasses parallels that for classes. Thus,
Integer superclass == Number, and
Integer class superclass == Number class.
However there is a singularity at Object. Here the class hierarchy terminates, but the metaclass hierarchy must wrap around to Class, since ALL metaclasses are subclasses of Class. Thus,
Object superclass == nil, and
Object class superclass == Class.
[Subtle detail] A class is know by name to an environment. Typically this is the SystemDictionary named Smalltalk. If we ever make lightweight classes that are not in Smalltalk, they must be in some environment. Specifically, the code that sets 'wasPresent' in name:inEnvironment:subclassOf:instanceVariableNames:variable:words:pointers:classVariableNames:poolDictionaries:category:comment:changed: must continue to work.!
Item was changed:
+ ----- Method: Behavior>>emptyMethodDictionary (in category 'initialize-release') -----
- ----- Method: Behavior>>emptyMethodDictionary (in category 'initialization') -----
emptyMethodDictionary
^ MethodDictionary new!
Item was changed:
+ ----- Method: ClassDescription>>notifyOfRecategorizedSelector:from:to: (in category 'organization') -----
- ----- Method: ClassDescription>>notifyOfRecategorizedSelector:from:to: (in category 'organization updating') -----
notifyOfRecategorizedSelector: element from: oldCategory to: newCategory
SystemChangeNotifier uniqueInstance selector: element recategorizedFrom: oldCategory to: newCategory inClass: self!
Item was removed:
- ----- Method: Class>>shouldNotBeRedefined (in category 'initialize-release') -----
- shouldNotBeRedefined
- "temporarily, since I know what I'm doing"
- ^false!
Andreas Raab uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ar.356.mcz
==================== Summary ====================
Name: Kernel-ar.356
Author: ar
Time: 30 December 2009, 2:12:47 am
UUID: b39efe07-b842-5d4f-813e-47f315bd4fdf
Ancestors: Kernel-ar.355
Temporarily disable warning about class redefinition to remove unused ivars from traits.
=============== Diff against Kernel-ar.353 ===============
Item was added:
+ ----- Method: Class>>shouldNotBeRedefined (in category 'initialize-release') -----
+ shouldNotBeRedefined
+ "temporarily, since I know what I'm doing"
+ ^false!
Item was changed:
----- Method: CompiledMethod>>getSourceFor:in: (in category 'source code management') -----
getSourceFor: selector in: class
"Retrieve or reconstruct the source code for this method."
| trailer source |
trailer := self trailer.
trailer tempNames ifNotNil: [:namesString |
"Magic sources -- decompile with temp names"
^ ((class decompilerClass new withTempNames: namesString)
decompile: selector in: class method: self)
decompileString].
trailer sourceCode ifNotNil: [:code | ^ code ].
trailer hasSourcePointer ifFalse: [
"No source pointer -- decompile without temp names"
^ (class decompilerClass new decompile: selector in: class method: self)
decompileString].
"Situation normal; read the sourceCode from the file"
source := [self getSourceFromFile]
on: Error
"An error can happen here if, for example, the changes file has been truncated by an aborted download. The present solution is to ignore the error and fall back on the decompiler. A more thorough solution should probably trigger a systematic invalidation of all source pointers past the end of the changes file. Consider that, as time goes on, the changes file will eventually grow large enough to cover the lost code, and then instead of falling into this error case, random source code will get returned."
do: [ :ex | ex return: nil].
+ ^source ifNil: [
- ^source
- ifNotNil: [
- | sourceSelector |
- "I think this is something to do with the traits system. It would be ncie if someone
- documented this. It looks like an egregious hack to me. eem 9/5/2009 09:04"
- (class isAliasSelector: selector)
- ifFalse: [ source ]
- ifTrue: [ "Only alias selectors need this replacement"
- sourceSelector := Parser parserClass new parseSelector: source.
- sourceSelector = selector
- ifTrue: [ source ]
- ifFalse: [ self replace: sourceSelector with: selector in: source ] ] ]
- ifNil: [
"Something really wrong -- decompile blind (no temps)"
(class decompilerClass new decompile: selector in: class method: self)
decompileString]!
Item was removed:
- ----- Method: Metaclass>>traitComposition (in category 'accessing') -----
- traitComposition
- "Vector the creation through ClassDescription to support alternative traits"
- ^traitComposition ifNil: [traitComposition := ClassDescription newTraitComposition].!
Item was removed:
- ----- Method: Class>>traitComposition: (in category 'accessing') -----
- traitComposition: aTraitComposition
- super traitComposition: aTraitComposition.
- traitComposition := aTraitComposition!
Item was removed:
- ----- Method: Metaclass>>traitComposition: (in category 'accessing') -----
- traitComposition: aTraitComposition
- super traitComposition: aTraitComposition.
- traitComposition := aTraitComposition!
Item was removed:
- ----- Method: Class>>traitComposition (in category 'accessing') -----
- traitComposition
- "Vector the creation through ClassDescription to support alternative traits"
- ^traitComposition ifNil: [traitComposition := ClassDescription newTraitComposition].!
Andreas Raab uploaded a new version of Traits to project The Trunk:
http://source.squeak.org/trunk/Traits-ar.264.mcz
==================== Summary ====================
Name: Traits-ar.264
Author: ar
Time: 30 December 2009, 3:03:01 am
UUID: d97a55ef-c640-a34e-8e45-5d0883cf1488
Ancestors: Traits-ar.263
Push traitsComposition into TraitOrganizer.
=============== Diff against Traits-ar.263 ===============
Item was added:
+ ----- Method: Trait class>>initialize (in category 'class initialization') -----
+ initialize
+ "Push traitsComposition down into organizer"
+ Smalltalk allClassesAndTraits do:[:aClass|
+ aClass traitComposition: aClass traitComposition.
+ aClass classSide traitComposition: aClass classSide traitComposition.
+ ].!
Andreas Raab uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ar.353.mcz
==================== Summary ====================
Name: Kernel-ar.353
Author: ar
Time: 30 December 2009, 2:59:15 am
UUID: 6854a358-f04b-c04c-9584-10181b0c5523
Ancestors: Kernel-ar.352
Prepare to push the trait composition into TraitOrganizer to avoid duplication in three places (Class, Metaclass, TraitDescription).
=============== Diff against Kernel-ar.352 ===============
Item was changed:
----- Method: ClassDescription>>zapOrganization (in category 'organization') -----
zapOrganization
"Remove the organization of this class by message categories.
This is typically done to save space in small systems. Classes and methods
created or filed in subsequently will, nonetheless, be organized"
+ self hasTraitComposition ifFalse:[
+ self organization: nil.
+ self isClassSide ifFalse: [self classSide zapOrganization]
+ ].!
- self organization: nil.
- self isClassSide ifFalse: [self classSide zapOrganization]!
Item was changed:
----- Method: Behavior>>obsolete (in category 'initialization') -----
obsolete
"Invalidate and recycle local methods,
e.g., zap the method dictionary if can be done safely."
self canZapMethodDictionary
+ ifTrue: [self methodDict: self emptyMethodDictionary].!
- ifTrue: [self methodDict: self emptyMethodDictionary].
- self hasTraitComposition ifTrue: [
- self traitComposition traits do: [:each |
- each removeUser: self]]!
Item was changed:
----- Method: Class>>traitComposition: (in category 'accessing') -----
traitComposition: aTraitComposition
+ super traitComposition: aTraitComposition.
traitComposition := aTraitComposition!
Item was changed:
----- Method: ClassDescription>>obsolete (in category 'initialize-release') -----
obsolete
"Make the receiver obsolete."
+ self hasTraitComposition ifTrue: [
+ self traitComposition traits do: [:each |
+ each removeUser: self]].
superclass removeSubclass: self.
self organization: nil.
super obsolete.!
Item was changed:
----- Method: Metaclass>>traitComposition: (in category 'accessing') -----
traitComposition: aTraitComposition
+ super traitComposition: aTraitComposition.
traitComposition := aTraitComposition!