Tony Garnock-Jones uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-tonyg.1224.mcz ==================== Summary ==================== Name: System-tonyg.1224 Author: tonyg Time: 29 March 2021, 10:15:02.279821 am UUID: 9d897d72-46fc-4205-a27b-89c7a50ac104 Ancestors: System-mt.1223 Teach SystemOrganizer about multiple environments. =============== Diff against System-mt.1223 =============== Item was changed: Categorizer subclass: #SystemOrganizer + instanceVariableNames: 'environment' - instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'System-Support'! !SystemOrganizer commentStamp: '<historical>' prior: 0! My instances provide an organization for the classes in the system, just as a ClassOrganizer organizes the messages within a class. The only difference is the methods for fileIn/Out.! Item was changed: ----- Method: SystemOrganizer>>classesIn: (in category 'query') ----- classesIn: categoryName | classes | classes := OrderedCollection new. self categories withIndexCollect: [:cat :idx | (categoryName match: cat) ifTrue: [classes addAll: (self listAtCategoryNumber: idx)] ifFalse: [nil]]. + ^ classes collect: [:clsName | self environment classNamed: clsName]! - ^ classes collect: [:clsName | Smalltalk classNamed: clsName]! Item was changed: ----- Method: SystemOrganizer>>classify:under: (in category 'accessing') ----- classify: element under: newCategory | oldCategory class | self flag: #environments. "do we want notifications for classes in other environments?" oldCategory := self categoryOfElement: element. super classify: element under: newCategory. + class := self environment at: element ifAbsent: [^ self]. - class := Smalltalk at: element ifAbsent: [^ self]. self == SystemOrganization ifTrue: [ SystemChangeNotifier uniqueInstance class: class recategorizedFrom: oldCategory to: newCategory]! Item was changed: ----- Method: SystemOrganizer>>commentInventory: (in category 'query') ----- commentInventory: categoryName "SystemOrganization commentInventory: 'Morphic*'" | classes commentedClasses | classes := OrderedCollection new. self categories withIndexCollect: [:cat :idx | (categoryName match: cat) ifTrue: [classes addAll: (self listAtCategoryNumber: idx)] ifFalse: [nil]]. + commentedClasses := classes select: [:catCls | (self environment at: catCls) hasComment]. - commentedClasses := classes select: [:catCls | (Smalltalk at: catCls) hasComment]. ^ 'There are ' , classes size asString , ' classes in ' , categoryName , ' of which ' , commentedClasses size asString , ' have comments and ', (classes size - commentedClasses size) asString , ' do not yet have comments.' ! Item was added: + ----- Method: SystemOrganizer>>environment (in category 'accessing') ----- + environment + ^ environment ifNil: [Smalltalk globals]! Item was added: + ----- Method: SystemOrganizer>>environment: (in category 'accessing') ----- + environment: anEnvironment + environment := anEnvironment! Item was changed: ----- Method: SystemOrganizer>>fileOutCategory:on:initializing: (in category 'fileIn/Out') ----- fileOutCategory: category on: aFileStream initializing: aBool "Store on the file associated with aFileStream, all the traits and classes associated with the category and any requested shared pools in the right order." | first poolSet tempClass classes traits | traits := self orderedTraitsIn: category. classes := self superclassOrder: category. poolSet := Set new. classes do: [:class | class sharedPools do: [:eachPool | poolSet add: eachPool]]. poolSet size > 0 ifTrue: [ tempClass := Class new. tempClass shouldFileOutPools ifTrue: [ poolSet := poolSet select: [:aPool | + tempClass shouldFileOutPool: (self environment keyAtIdentityValue: aPool)]. - tempClass shouldFileOutPool: (Smalltalk globals keyAtIdentityValue: aPool)]. poolSet do: [:aPool | tempClass fileOutPool: aPool onFileStream: aFileStream]]]. first := true. traits, classes do: [:each | first ifTrue: [first := false] ifFalse: [aFileStream cr; nextPut: Character newPage; cr]. each fileOutOn: aFileStream moveSource: false toFile: 0 initializing: false]. aBool ifTrue: [classes do: [:cls | cls fileOutInitializerOn: aFileStream]].! Item was changed: ----- Method: SystemOrganizer>>orderedTraitsIn: (in category 'fileIn/Out') ----- orderedTraitsIn: category "Answer an OrderedCollection containing references to the traits in the category whose name is the argument, category (a string). The traits are ordered so they can be filed in." | behaviors traits | behaviors := (self listAtCategoryNamed: category asSymbol) + collect: [:title | self environment at: title]. - collect: [:title | Smalltalk at: title]. traits := behaviors reject: [:each | each isBehavior]. ^traits asArray sort: [:t1 :t2 | (t2 traitComposition allTraits includes: t1) or: [(t1 traitComposition allTraits includes: t2) not]]! Item was changed: ----- Method: SystemOrganizer>>removeMissingClasses (in category 'remove') ----- removeMissingClasses "Remove any class names that are no longer in the Smalltalk dictionary. Used for cleaning up after garbage collecting user-generated classes." "SystemOrganization removeMissingClasses" elementArray copy do: [:el | + (self environment includesKey: el) ifFalse: [self removeElement: el]]. - (Smalltalk includesKey: el) ifFalse: [self removeElement: el]]. ! Item was changed: ----- Method: SystemOrganizer>>superclassOrder: (in category 'fileIn/Out') ----- superclassOrder: category "Answer an OrderedCollection containing references to the classes in the category whose name is the argument, category (a string). The classes are ordered with superclasses first so they can be filed in." | behaviors classes | behaviors := (self listAtCategoryNamed: category asSymbol) + collect: [:title | self environment at: title]. - collect: [:title | Smalltalk at: title]. classes := behaviors select: [:each | each isBehavior]. ^ChangeSet superclassOrder: classes! |
Hi Tony. I suppose that the idea was that every environment has its own system organization. By adding a back reference from organization to environment, there is still no support of "multiple" environments. Do you plan to change this dynamically? If so, why? :-) Would you sketch an example? Best, Marcel
|
On 3/29/21 10:36 AM, Marcel Taeumel wrote:
> I suppose that the idea was that every environment has its own system > organization. Exactly. They already do: but the problem is that doing anything with the resulting SystemOrganizer resulted in changes to *Smalltalk globals*! So this allows the per-Environment organizers to scope their effects correctly. > By adding a back reference from organization to > environment, there is still no support of "multiple" environments. Do > you plan to change this dynamically? If so, why? :-) Would you sketch an > example? It wouldn't change dynamically: instead, it is set at construction time. See related change Environments-tonyg.80. Regards, Tony |
I noticed this, btw, removing a system category from a non-default
environment, only to find the classes in Smalltalk were removed :-) On 3/29/21 10:42 AM, Tony Garnock-Jones wrote: > On 3/29/21 10:36 AM, Marcel Taeumel wrote: >> I suppose that the idea was that every environment has its own system >> organization. > > Exactly. They already do: but the problem is that doing anything with > the resulting SystemOrganizer resulted in changes to *Smalltalk > globals*! So this allows the per-Environment organizers to scope their > effects correctly. > >> By adding a back reference from organization to environment, there is >> still no support of "multiple" environments. Do you plan to change >> this dynamically? If so, why? :-) Would you sketch an example? > > It wouldn't change dynamically: instead, it is set at construction time. > See related change Environments-tonyg.80. > > Regards, > Tony > |
Ah, nevermind. You wanted to remove all those "Smalltalk classNamed:" references from SystemOrganizer. :-) Best, Marcel
|
In reply to this post by marcel.taeumel
> On 2021-03-29, at 1:36 AM, Marcel Taeumel <[hidden email]> wrote: > Would you sketch an example? Leaving aside specifics of what Tony is doing, I'm still waiting for an explanation of what any of the environment stuff will actually do for me. None of my experiences with name space related things have ever been pleasurable. tim -- tim Rowledge; [hidden email]; http://www.rowledge.org/tim Never underestimate the bandwidth of a station wagon full of tapes. |
Free forum by Nabble | Edit this page |