Nicolas Cellier uploaded a new version of Monticello to project The Trunk:
http://source.squeak.org/trunk/Monticello-ct.715.mcz ==================== Summary ==================== Name: Monticello-ct.715 Author: ct Time: 6 February 2020, 6:58:26.533648 pm UUID: 199bf8a3-5eee-1045-a44b-89ad30fa5523 Ancestors: Monticello-cmm.708 Fixes wrong load and unload order of MCScriptDefinitions See http://forum.world.st/Monticello-Bug-Preamble-of-removal-is-executed-too-late-tp5108401.html. Regression tests are in Tests-ct.426. Please review! =============== Diff against Monticello-cmm.708 =============== Item was added: + ----- Method: MCDefinition>>wantsToBeOutermost (in category 'testing') ----- + wantsToBeOutermost + + ^ false! Item was changed: Object subclass: #MCDependencySorter + instanceVariableNames: 'required provided deferred orderedItems' - instanceVariableNames: 'required provided orderedItems' classVariableNames: '' poolDictionaries: '' category: 'Monticello-Loading'! Item was changed: ----- Method: MCDependencySorter>>add: (in category 'building') ----- add: anItem | requirements | + (anItem wantsToBeOutermost) + ifTrue: [^self addDeferred: anItem]. requirements := self unresolvedRequirementsFor: anItem. requirements isEmpty ifTrue: [self addToOrder: anItem] ifFalse: [self addRequirements: requirements for: anItem]. ^anItem! Item was added: + ----- Method: MCDependencySorter>>addDeferred (in category 'building') ----- + addDeferred + deferred do: [:ea | + self addToOrder: ea].! Item was added: + ----- Method: MCDependencySorter>>addDeferred: (in category 'private') ----- + addDeferred: anItem + ^ deferred add: anItem! Item was changed: ----- Method: MCDependencySorter>>initialize (in category 'initialize-release') ----- initialize provided := Set new. required := Dictionary new. + orderedItems := OrderedCollection new. + deferred := OrderedCollection new.! - orderedItems := OrderedCollection new.! Item was changed: ----- Method: MCPackageLoader>>sorterForItems: (in category 'private') ----- sorterForItems: aCollection | sorter | sorter := MCDependencySorter items: aCollection. sorter addExternalProvisions: self provisions. + sorter addDeferred. ^ sorter! Item was added: + ----- Method: MCPostscriptDefinition>>wantsToBeOutermost (in category 'nil') ----- + wantsToBeOutermost + + ^ true! Item was added: + ----- Method: MCRemovalPreambleDefinition>>wantsToBeOutermost (in category 'testing') ----- + wantsToBeOutermost + + ^ true! |
It looks like this broke the writing of postscripts in FileTree repositories.
MCFileTreePackageStructureStWriter>>acceptVisitor:forDefinitions: (MCDependencySorter sortItems: aCollection) does not include an MCPostscriptDefinition that is still present in aCollection. MCDependencySorter class>>sortItems: The sorter includes the MCPostscriptDefinition in the new deferred list, but not in the orderedItems. Therefore it is not included in the result of sortItems:, because it only returns the orderedItems, not the deferred ones. Christoph, can and must sortItems: be fixed or a different method? Am Do., 5. März 2020 um 21:05 Uhr schrieb <[hidden email]>: > > Nicolas Cellier uploaded a new version of Monticello to project The Trunk: > http://source.squeak.org/trunk/Monticello-ct.715.mcz > > ==================== Summary ==================== > > Name: Monticello-ct.715 > Author: ct > Time: 6 February 2020, 6:58:26.533648 pm > UUID: 199bf8a3-5eee-1045-a44b-89ad30fa5523 > Ancestors: Monticello-cmm.708 > > Fixes wrong load and unload order of MCScriptDefinitions > > See http://forum.world.st/Monticello-Bug-Preamble-of-removal-is-executed-too-late-tp5108401.html. Regression tests are in Tests-ct.426. > > Please review! > > =============== Diff against Monticello-cmm.708 =============== > > Item was added: > + ----- Method: MCDefinition>>wantsToBeOutermost (in category 'testing') ----- > + wantsToBeOutermost > + > + ^ false! > > Item was changed: > Object subclass: #MCDependencySorter > + instanceVariableNames: 'required provided deferred orderedItems' > - instanceVariableNames: 'required provided orderedItems' > classVariableNames: '' > poolDictionaries: '' > category: 'Monticello-Loading'! > > Item was changed: > ----- Method: MCDependencySorter>>add: (in category 'building') ----- > add: anItem > | requirements | > + (anItem wantsToBeOutermost) > + ifTrue: [^self addDeferred: anItem]. > requirements := self unresolvedRequirementsFor: anItem. > requirements isEmpty > ifTrue: [self addToOrder: anItem] > ifFalse: [self addRequirements: requirements for: anItem]. > ^anItem! > > Item was added: > + ----- Method: MCDependencySorter>>addDeferred (in category 'building') ----- > + addDeferred > + deferred do: [:ea | > + self addToOrder: ea].! > > Item was added: > + ----- Method: MCDependencySorter>>addDeferred: (in category 'private') ----- > + addDeferred: anItem > + ^ deferred add: anItem! > > Item was changed: > ----- Method: MCDependencySorter>>initialize (in category 'initialize-release') ----- > initialize > provided := Set new. > required := Dictionary new. > + orderedItems := OrderedCollection new. > + deferred := OrderedCollection new.! > - orderedItems := OrderedCollection new.! > > Item was changed: > ----- Method: MCPackageLoader>>sorterForItems: (in category 'private') ----- > sorterForItems: aCollection > | sorter | > sorter := MCDependencySorter items: aCollection. > sorter addExternalProvisions: self provisions. > + sorter addDeferred. > ^ sorter! > > Item was added: > + ----- Method: MCPostscriptDefinition>>wantsToBeOutermost (in category 'nil') ----- > + wantsToBeOutermost > + > + ^ true! > > Item was added: > + ----- Method: MCRemovalPreambleDefinition>>wantsToBeOutermost (in category 'testing') ----- > + wantsToBeOutermost > + > + ^ true! > > |
Forgot to mention the net result of the issue: the postscripts gets
effectively removed in the saved version. Am Fr., 10. Apr. 2020 um 00:02 Uhr schrieb Jakob Reschke <[hidden email]>: > > It looks like this broke the writing of postscripts in FileTree repositories. > > MCFileTreePackageStructureStWriter>>acceptVisitor:forDefinitions: > (MCDependencySorter sortItems: aCollection) does not include an > MCPostscriptDefinition that is still present in aCollection. > > MCDependencySorter class>>sortItems: > The sorter includes the MCPostscriptDefinition in the new deferred > list, but not in the orderedItems. Therefore it is not included in the > result of sortItems:, because it only returns the orderedItems, not > the deferred ones. > > Christoph, can and must sortItems: be fixed or a different method? > > > Am Do., 5. März 2020 um 21:05 Uhr schrieb <[hidden email]>: > > > > Nicolas Cellier uploaded a new version of Monticello to project The Trunk: > > http://source.squeak.org/trunk/Monticello-ct.715.mcz > > > > ==================== Summary ==================== > > > > Name: Monticello-ct.715 > > Author: ct > > Time: 6 February 2020, 6:58:26.533648 pm > > UUID: 199bf8a3-5eee-1045-a44b-89ad30fa5523 > > Ancestors: Monticello-cmm.708 > > > > Fixes wrong load and unload order of MCScriptDefinitions > > > > See http://forum.world.st/Monticello-Bug-Preamble-of-removal-is-executed-too-late-tp5108401.html. Regression tests are in Tests-ct.426. > > > > Please review! > > > > =============== Diff against Monticello-cmm.708 =============== > > > > Item was added: > > + ----- Method: MCDefinition>>wantsToBeOutermost (in category 'testing') ----- > > + wantsToBeOutermost > > + > > + ^ false! > > > > Item was changed: > > Object subclass: #MCDependencySorter > > + instanceVariableNames: 'required provided deferred orderedItems' > > - instanceVariableNames: 'required provided orderedItems' > > classVariableNames: '' > > poolDictionaries: '' > > category: 'Monticello-Loading'! > > > > Item was changed: > > ----- Method: MCDependencySorter>>add: (in category 'building') ----- > > add: anItem > > | requirements | > > + (anItem wantsToBeOutermost) > > + ifTrue: [^self addDeferred: anItem]. > > requirements := self unresolvedRequirementsFor: anItem. > > requirements isEmpty > > ifTrue: [self addToOrder: anItem] > > ifFalse: [self addRequirements: requirements for: anItem]. > > ^anItem! > > > > Item was added: > > + ----- Method: MCDependencySorter>>addDeferred (in category 'building') ----- > > + addDeferred > > + deferred do: [:ea | > > + self addToOrder: ea].! > > > > Item was added: > > + ----- Method: MCDependencySorter>>addDeferred: (in category 'private') ----- > > + addDeferred: anItem > > + ^ deferred add: anItem! > > > > Item was changed: > > ----- Method: MCDependencySorter>>initialize (in category 'initialize-release') ----- > > initialize > > provided := Set new. > > required := Dictionary new. > > + orderedItems := OrderedCollection new. > > + deferred := OrderedCollection new.! > > - orderedItems := OrderedCollection new.! > > > > Item was changed: > > ----- Method: MCPackageLoader>>sorterForItems: (in category 'private') ----- > > sorterForItems: aCollection > > | sorter | > > sorter := MCDependencySorter items: aCollection. > > sorter addExternalProvisions: self provisions. > > + sorter addDeferred. > > ^ sorter! > > > > Item was added: > > + ----- Method: MCPostscriptDefinition>>wantsToBeOutermost (in category 'nil') ----- > > + wantsToBeOutermost > > + > > + ^ true! > > > > Item was added: > > + ----- Method: MCRemovalPreambleDefinition>>wantsToBeOutermost (in category 'testing') ----- > > + wantsToBeOutermost > > + > > + ^ true! > > > > |
Hi Jakob,
Thanks for the report - and I'm sorry to hear that I broke this!
The motivation for the deferred list was that #addToOrder: (and so the constructor #items:) actually does not sort the added items, but only their dependencies. That's why you need to send #addDeferred to the sorter after adding all other items. Before now, I did not realize that #orderedItems has external users.
So there are two options: 1. Permanently change the public protocol of the dependency sorter - if you want to get all items, you need to send #addDeferred ti the sorter before retrieving the #orderedItems. In the Trunk, we would need to update four senders in three classes for this solution. 2. Change #orderedItems to lazily append the deferred items to the returned list. This is not ideal as it makes the getter more expensive, but on the other hand, we can preserve compatibility by doing so.
I'm open for your opinion on both approaches, or for any other idea! :-)
Best, Christoph Von: Jakob Reschke <[hidden email]>
Gesendet: Freitag, 10. April 2020 00:03:47 An: Thiede, Christoph; [hidden email] Betreff: Re: [squeak-dev] The Trunk: Monticello-ct.715.mcz Forgot to mention the net result of the issue: the postscripts gets
effectively removed in the saved version. Am Fr., 10. Apr. 2020 um 00:02 Uhr schrieb Jakob Reschke <[hidden email]>: > > It looks like this broke the writing of postscripts in FileTree repositories. > > MCFileTreePackageStructureStWriter>>acceptVisitor:forDefinitions: > (MCDependencySorter sortItems: aCollection) does not include an > MCPostscriptDefinition that is still present in aCollection. > > MCDependencySorter class>>sortItems: > The sorter includes the MCPostscriptDefinition in the new deferred > list, but not in the orderedItems. Therefore it is not included in the > result of sortItems:, because it only returns the orderedItems, not > the deferred ones. > > Christoph, can and must sortItems: be fixed or a different method? > > > Am Do., 5. März 2020 um 21:05 Uhr schrieb <[hidden email]>: > > > > Nicolas Cellier uploaded a new version of Monticello to project The Trunk: > > http://source.squeak.org/trunk/Monticello-ct.715.mcz > > > > ==================== Summary ==================== > > > > Name: Monticello-ct.715 > > Author: ct > > Time: 6 February 2020, 6:58:26.533648 pm > > UUID: 199bf8a3-5eee-1045-a44b-89ad30fa5523 > > Ancestors: Monticello-cmm.708 > > > > Fixes wrong load and unload order of MCScriptDefinitions > > > > See http://forum.world.st/Monticello-Bug-Preamble-of-removal-is-executed-too-late-tp5108401.html. Regression tests are in Tests-ct.426. > > > > Please review! > > > > =============== Diff against Monticello-cmm.708 =============== > > > > Item was added: > > + ----- Method: MCDefinition>>wantsToBeOutermost (in category 'testing') ----- > > + wantsToBeOutermost > > + > > + ^ false! > > > > Item was changed: > > Object subclass: #MCDependencySorter > > + instanceVariableNames: 'required provided deferred orderedItems' > > - instanceVariableNames: 'required provided orderedItems' > > classVariableNames: '' > > poolDictionaries: '' > > category: 'Monticello-Loading'! > > > > Item was changed: > > ----- Method: MCDependencySorter>>add: (in category 'building') ----- > > add: anItem > > | requirements | > > + (anItem wantsToBeOutermost) > > + ifTrue: [^self addDeferred: anItem]. > > requirements := self unresolvedRequirementsFor: anItem. > > requirements isEmpty > > ifTrue: [self addToOrder: anItem] > > ifFalse: [self addRequirements: requirements for: anItem]. > > ^anItem! > > > > Item was added: > > + ----- Method: MCDependencySorter>>addDeferred (in category 'building') ----- > > + addDeferred > > + deferred do: [:ea | > > + self addToOrder: ea].! > > > > Item was added: > > + ----- Method: MCDependencySorter>>addDeferred: (in category 'private') ----- > > + addDeferred: anItem > > + ^ deferred add: anItem! > > > > Item was changed: > > ----- Method: MCDependencySorter>>initialize (in category 'initialize-release') ----- > > initialize > > provided := Set new. > > required := Dictionary new. > > + orderedItems := OrderedCollection new. > > + deferred := OrderedCollection new.! > > - orderedItems := OrderedCollection new.! > > > > Item was changed: > > ----- Method: MCPackageLoader>>sorterForItems: (in category 'private') ----- > > sorterForItems: aCollection > > | sorter | > > sorter := MCDependencySorter items: aCollection. > > sorter addExternalProvisions: self provisions. > > + sorter addDeferred. > > ^ sorter! > > > > Item was added: > > + ----- Method: MCPostscriptDefinition>>wantsToBeOutermost (in category 'nil') ----- > > + wantsToBeOutermost > > + > > + ^ true! > > > > Item was added: > > + ----- Method: MCRemovalPreambleDefinition>>wantsToBeOutermost (in category 'testing') ----- > > + wantsToBeOutermost > > + > > + ^ true! > > > >
Carpe Squeak!
|
Hi Jakob, hi all,
> Did you intentionally not reply the mailing list? I could not find your previous mail on the list, too! However, we're back on the list now :)
Hm ... what about deprecating #orderedItems and introducing a new #allItems instead? Then we could avoid any internal confusion and had a stable public protocol.
> Which reminds me in general that Monticello classes could use some class comments. :-(
A really good idea! :D
Best,
Christoph
Von: Jakob Reschke <[hidden email]>
Gesendet: Samstag, 11. April 2020 15:53:11 An: Thiede, Christoph Betreff: Re: [squeak-dev] The Trunk: Monticello-ct.715.mcz Hi Christoph,
Did you intentionally not reply the mailing list?
We should care, the method is public and AFAIK the class is also not in some private category. Also "outsiders" should not care about the instance variable, but about the interface. Which was altered by this change.
Which reminds me in general that Monticello classes could use some class comments. :-(
Kinds regards,
Jakob
Thiede, Christoph <[hidden email]> schrieb am Sa., 11. Apr. 2020, 14:41:
Carpe Squeak!
|
Am Sa., 11. Apr. 2020 um 16:42 Uhr schrieb Thiede, Christoph
<[hidden email]>: > > I could not find your previous mail on the list, too! However, we're back on the list now :) Oh, it was indeed my mistake, sorry. Quick summary for the others: I doubted that there is a use case to get the incomplete list of orderedItems and thus voted to change it. Christoph argued that it is strange to let the accessor method return anything else than the instance variable of the same name. > > Hm ... what about deprecating #orderedItems and introducing a new #allItems instead? Then we could avoid any internal confusion and had a stable public protocol. > I'd say the other way around: introduce a new selector for the new behavior (if necessary) and leave the observable behavior of orderedItems as it was. Rename the instance variable accordingly if necessary, as the variable is an implementation detail, the selector is not. |
Free forum by Nabble | Edit this page |