On Tue, 18 Apr 2000, Michael_Chean wrote:
Perhaps the original poster _did_ try "reverse<Cmd-Shift-W>" and was confused by the fact that "FlippyArray2" does contain a 'reverse' method, as do quite a number of classes, sometimes meaning "reverse order" and sometimes meaning "opposite colour".
Yep, actually this is what happened. It was more confusing in that I was looking for something to do with the class String - so from my beginners point of view the reversed in OrderedCollection wasn't an immediate match. Thank goodness that the OrederedCollection actually had an example of reversed which clued me into the similiarity. Otherwise the Newbie must try to decipher from the description or code what is going on.
Here is an enhancement to the Method Finder which will hopefully help to narrow down the appropriate class in these situations. (I realize that you were not using Method Finder here, but if you were, this might have helped.)
This is an enhancement to the "example mode" of the Method Finder. When an example is given, and one of the found methods is selected from the list, the classes in the class list which match the class (or are a superclass) of the receiver will be specially marked with an asterisk.
For example, if the example 'abcd'. 'dcba' is given in the top pane, the method 'reversed' will appear in the method list. When 'reversed' is selected, eight classes will appear in the class list, but now SequenceableCollection>>reversed will be asterisked, since that is the class/method that is actually being used in this example. (because String is a subclass of SequenceableCollection) Generally, the asterisked class is really the one we're looking for... the other seven classes are basically irrelevant to the example, although it's useful to at least leave them in the list.
The asterisk appears before the class/method name, so the asterisked classes end up being moved to the top of the list, since they're sorted alphabetically. I think this is handy, anyway. (My original plan was to make the matching classes appear in bold instead of using an asterisk, but that looked like it would be a lot harder to implement.)
Here are some other fun examples to try when testing this enhancement:
'abc'. 'ab'. true 'abcd'. $c. 3 1. 2. true #(10 20 30 40). 20. 50. #(10 50 30 40) #(1 2 3) asOrderedCollection. 4. 4 Date. Date today
Of course, no classes will be asterisked if you use the "selector fragment" mode. I didn't try to implement it for the "multi-example" mode which appears in MethodFinder>>methodFor:, either.
Also, I suppose it might be best to only asterisk the "nearest" superclass and not all superclasses, so that only one class would ever be asterisked. But that looked a little bit hairy to implement, so I kept it simple for now.
The attached changeset just makes a couple of changes to SelectorBrowser... mainly, SelectorBrowser>>markMatchingClasses was added, plus selectedClass was tweaked to handle parsing the extra asterisk.
(I guess I just missed the last batch of updates for 2.8, if this enhancement is deemed worthy of inclusion... keep it in mind the next time around. :-) )
Regarding the Method Finder, it is true that not very many newbies think to try the Method Finder... it definitely needs to appear in more Squeak tutorials. (Naturally, it isn't going to be in the old Smalltalk books, since it's a new thing.) Also, I think the explanatory text in the lower pane could be improved... the part about the example mode should give a couple of typical scenarios, like a mini-tutorial... I remember I missed the point the first time I read through it. Maybe I'll submit something.
- Doug Way EAI/Transom Technologies, Ann Arbor, MI http://www.transom.com dway@mat.net, @eai.com
Sigh. The changeset I sent last time was missing a method "markMatchingClasses" (the most important one).
This changeset should actually work.
- Doug Way EAI/Transom Technologies, Ann Arbor, MI http://www.transom.com dway@mat.net, @eai.com
On Wed, 26 Apr 2000, Doug Way wrote:
On Tue, 18 Apr 2000, Michael_Chean wrote:
Perhaps the original poster _did_ try "reverse<Cmd-Shift-W>" and was confused by the fact that "FlippyArray2" does contain a 'reverse' method, as do quite a number of classes, sometimes meaning "reverse order" and sometimes meaning "opposite colour".
Yep, actually this is what happened. It was more confusing in that I was looking for something to do with the class String - so from my beginners point of view the reversed in OrderedCollection wasn't an immediate match. Thank goodness that the OrederedCollection actually had an example of reversed which clued me into the similiarity. Otherwise the Newbie must try to decipher from the description or code what is going on.
Here is an enhancement to the Method Finder which will hopefully help to narrow down the appropriate class in these situations. (I realize that you were not using Method Finder here, but if you were, this might have helped.)
This is an enhancement to the "example mode" of the Method Finder. When an example is given, and one of the found methods is selected from the list, the classes in the class list which match the class (or are a superclass) of the receiver will be specially marked with an asterisk.
For example, if the example 'abcd'. 'dcba' is given in the top pane, the method 'reversed' will appear in the method list. When 'reversed' is selected, eight classes will appear in the class list, but now SequenceableCollection>>reversed will be asterisked, since that is the class/method that is actually being used in this example. (because String is a subclass of SequenceableCollection) Generally, the asterisked class is really the one we're looking for... the other seven classes are basically irrelevant to the example, although it's useful to at least leave them in the list.
The asterisk appears before the class/method name, so the asterisked classes end up being moved to the top of the list, since they're sorted alphabetically. I think this is handy, anyway. (My original plan was to make the matching classes appear in bold instead of using an asterisk, but that looked like it would be a lot harder to implement.)
Here are some other fun examples to try when testing this enhancement:
'abc'. 'ab'. true 'abcd'. $c. 3
- true
#(10 20 30 40). 20. 50. #(10 50 30 40) #(1 2 3) asOrderedCollection. 4. 4 Date. Date today
Of course, no classes will be asterisked if you use the "selector fragment" mode. I didn't try to implement it for the "multi-example" mode which appears in MethodFinder>>methodFor:, either.
Also, I suppose it might be best to only asterisk the "nearest" superclass and not all superclasses, so that only one class would ever be asterisked. But that looked a little bit hairy to implement, so I kept it simple for now.
The attached changeset just makes a couple of changes to SelectorBrowser... mainly, SelectorBrowser>>markMatchingClasses was added, plus selectedClass was tweaked to handle parsing the extra asterisk.
(I guess I just missed the last batch of updates for 2.8, if this enhancement is deemed worthy of inclusion... keep it in mind the next time around. :-) )
Regarding the Method Finder, it is true that not very many newbies think to try the Method Finder... it definitely needs to appear in more Squeak tutorials. (Naturally, it isn't going to be in the old Smalltalk books, since it's a new thing.) Also, I think the explanatory text in the lower pane could be improved... the part about the example mode should give a couple of typical scenarios, like a mini-tutorial... I remember I missed the point the first time I read through it. Maybe I'll submit something.
- Doug Way EAI/Transom Technologies, Ann Arbor, MI http://www.transom.com dway@mat.net, @eai.com
squeak-dev@lists.squeakfoundation.org