Hi, some time ago Yuriy cleaned up the RBBrowserEnvironment methods for allClassesAndTraits(Do), classesDo, .... on some SmallLint-rules (they arent applied on the class side) and the behavior (-> 14621 Some RBBrowserEnvironments don't work well with Metaclasses)) As some SmallLint-rules need to iterate over the metaclasses as well and I don't want to revert Yuriys change, I 'll add another method that collect classes and metaclasses. So, I need some help, how to name this methods: all classes (Object, Integer, ....) -> allClasses, ok all classes and metaclasses (Object, Object class, Integer class ) -> ? allBehaviors? all classes and traits -> allClassesAndTraits, ok all classes and meta classes and traits and class traits -> ? no idea! all metaclasses and class traits -> allMeta(ClassesAndTraits) ? I don't know if we need this One problem with "allBehaviors" is, SystemNavigation uses allBehaviors to iterate over classes, metaclasses, traits and class traits, allthough a Trait is not a Behavior. (TClass isBehavior -> false) feedback is welcome nicolai |
I’m ready to help with this issue, but as far as I can tell, it’s not hard to implement the mentors. Here we should decide on the meaning of the phrases. What are "all behaviors” and so on. The reason of the refactoring that I’ve done was that there were two methods with similar names that were doing different things. Uko
|
2014-12-18 22:32 GMT+01:00 Yuriy Tymchuk <[hidden email]>: Pharo 3.0:
SystemNavigation default allClasses size. 4024 Smalltalk allClasses size. 4024. RBBrowserEnvironment default allClasses size. 4024 RBBrowserEnvironment default classes size. 8048 Pharo 4.0: SystemNavigation default allClasses size. 5012 Smalltalk allClasses size. 5012 RBBrowserEnvironment default allClasses size. 5012 RBBrowserEnvironment default classes size. 5012 -> I "define" the Pharo 4.0 behavior as the correct one. RBEnvironment>>#classes should not contain meta classes. Some other RBEnvironments and/or RBRules rely on the "classes = classes and metaclasses" (-> see issue Some RBBrowserEnvironments don't work well with Metaclasses Some rules aren't applied on the classside anymore a RBEnvironment from #referencesTo: does not list meta classes I will change them, and if appropiate, add a new classesAndMetaclasses resp. classesAndMetaclassesDo: I don't know about classesAndMetaclassesTraits. And I skip "behaviors" for now. #allBehaviors is suspicious to me, I still don't know what they are: Smalltalk globals allBehaviors includes:TBehavior. -> true (1) TBehavior isBehavior. -> false (!) |
What if rules that need metaclasses ask for them explicitly to the class? environment allClasses do: [ :theInstanceSide | self doSomethingWith: theInstanceSide. self doSomethingWith: theInstanceSide classSide. ] Just putting another possibility on the table... El lun., 22 de jun. de 2015 a la(s) 10:40 p. m., Nicolai Hess <[hidden email]> escribió:
|
I would say, that besides #checkClass: and #checkMethod: rules should also have #checkMetaClass: this will allow rule developers to be more flexible, and will add a bit more certainty. Because sometimes you need to check both, then you implement a method and call it from #checkClass: and #checkMetaClass:. Sometimes you only need to check one of them. And you will always know that metaclass will not sendup in your method. Uko
|
In reply to this post by Guillermo Polito
2015-06-23 8:40 GMT+02:00 Guillermo Polito <[hidden email]>:
Yes, something like that.
|
In reply to this post by Uko2
2015-06-23 9:44 GMT+02:00 Yuriy Tymchuk <[hidden email]>:
And maybe we should exclude traits and provide a checkTrait method, because now there are some lint rules failing because there is code like checkClasse: aClass |meta| meta := aClass class. .... check on meta and if this method is called for a trait like TBehavior, TBehavior class -> Trait meta is not the classTrait of TBehavior but the Metaclass of Trait.
|
In reply to this post by Nicolai Hess
Ok, I still struggle with the right naming convention. For example, consider the method #flushEvents " the classes of the environment fore references to #flush events" (RBBrowserEnvironment new referencesTo:#flushEvents) classes 1. SmalltalkImage/WorldMorph/Object class 2. SmalltalkImage/WorldMorph/Object 3. SmalltalkImage/WorldMorph 1, because all three classes resp. the meta class "Object class" refer to this (this is how Pharo 3 behaves) 2, because all three classes have a method on the instance or class side refering to this (this is what I would expect) 3. because there are only two non-meta classes refering to this method (this is how Pharo4/5 behaves) ? I don't know, but this is crucial for deciding the way on how to clean the current RBEnvironments implementation. 2015-06-22 22:39 GMT+02:00 Nicolai Hess <[hidden email]>:
|
Since you probably want to query a method after on the class, I
would return 1
Because if I want two this is easy query collect: #theNonMetaclass 3 is a bug! When we look for refs we should get them all.
oh yes! Thanks for looking into it.
|
Free forum by Nabble | Edit this page |