Hi-
When I create methods using the Debugger's 'Create' button I am never sure which categories are used in the class I'm adding the method to versus those in its super classes. In an effort to not have to think about that any more I've adapted the ClassDescription>>#allMethodCategoriesIntegratedThrough: to put the method categories that are used in the target class first, then those in the super classes after that.
I think this should work in Pharo and Squeak but I've only tested it in Pharo 1.4. I've attached a changeset and also pasted the method below
Paul
allMethodCategoriesIntegratedThrough: mostGenericClass "Answer a list of all the method categories of the receiver and all its superclasses, up through mostGenericClass"
| otherClassCategories thisClassCategories combinedClassCategories | otherClassCategories := OrderedCollection new. self allSuperclasses do: [ :aClass | (aClass includesBehavior: mostGenericClass) ifTrue: [ otherClassCategories addAll: aClass organization categories ] ]. otherClassCategories remove: 'no messages' asSymbol ifAbsent: [ ]. thisClassCategories := self organization categories asSortedCollection: [ :a :b | a asLowercase < b asLowercase ]. ^ Array streamContents: [ :stream | stream nextPutAll: thisClassCategories; nextPutAll: ((otherClassCategories asSet removeAllSuchThat: [ :each | thisClassCategories includes: each ]) asSortedCollection: [ :a :b | a asLowercase < b asLowercase ]) ]
Hello,
To make this easy to review and integrate, what is the best is the following
1) add an issue to the issue tracker.
http://code.google.com/p/pharo/issues/list
I did it for this already for your report (to not forget it):
http://code.google.com/p/pharo/issues/detail?id=6896
2) to take advantage of an automatic test robot, attach a Slice to the bug report
After having added the report, this is easy. In a fresh image: -> do the change (e.g. load the .cs or .st) -> open Monticello -> Press the +Slice button -> put the issue number 6896 into the field and press "grab" -> select the slice and save it to the inbox -> put status to "FixReviewNeeded" or wait until someone else does it -> The famous monkey will load your slice and run all tests to see if you managed to break something essential.
Integration (or rejection) will happen quite fast after this (within 24 hours often, within some days for sure).
Marcus
On Nov 1, 2012, at 9:32 PM, Paul DeBruicker pdebruic@gmail.com wrote:
Hi-
When I create methods using the Debugger's 'Create' button I am never sure which categories are used in the class I'm adding the method to versus those in its super classes. In an effort to not have to think about that any more I've adapted the ClassDescription>>#allMethodCategoriesIntegratedThrough: to put the method categories that are used in the target class first, then those in the super classes after that.
I think this should work in Pharo and Squeak but I've only tested it in Pharo 1.4. I've attached a changeset and also pasted the method below
Paul
allMethodCategoriesIntegratedThrough: mostGenericClass "Answer a list of all the method categories of the receiver and all its superclasses, up through mostGenericClass"
| otherClassCategories thisClassCategories combinedClassCategories | otherClassCategories := OrderedCollection new. self allSuperclasses do: [ :aClass | (aClass includesBehavior: mostGenericClass) ifTrue: [ otherClassCategories addAll: aClass organization categories ] ]. otherClassCategories remove: 'no messages' asSymbol ifAbsent: [ ]. thisClassCategories := self organization categories asSortedCollection: [ :a :b | a asLowercase < b asLowercase ]. ^ Array streamContents: [ :stream | stream nextPutAll: thisClassCategories; nextPutAll: ((otherClassCategories asSet removeAllSuchThat: [ :each | thisClassCategories includes: each ]) asSortedCollection: [ :a :b | a asLowercase < b asLowercase ]) ] <ClassDescription-allMethodCategoriesIntegratedThrough.st>
-- Marcus Denker -- http://marcusdenker.de
squeak-dev@lists.squeakfoundation.org