Path: utzoo!utgpu!water!watmath!clyde!att!rutgers!njin!princeton!udel!rochester!bbn!uwmcsd1!ig!agate!pasteur!ames!lll-tis!lll-winken!uunet!mcvax!ukc!dcl-cs!nott-cs!thomas.cs.bham.ac.uk!nhj From: nhj@cs.bham.ac.uk (Nick Jurascheck ) Newsgroups: comp.lang.smalltalk Subject: Re: browsing by partial method name. Keywords: smalltalk Message-ID: <308@thomas.cs.bham.ac.uk> Date: 7 Jun 88 15:53:12 GMT Organization: Birmingham University, England Lines: 49 >>Can someone answer this (novice) question: I would like to open a >>browser for all methods whose selector contains a specified string >>(e.g. 'Sensor'). I assume that the way to do this is to use >>browseAllSelections: and to provide a block that evaluates to true >>when the selector meets this criteria, but can someone tell me what >>this block should be? Thanks for any help. The method browseAllSelect supplies a CompiledMethod variable for the input parameter block, and this does not have the selector name as one of its attributes. For this reason browseAllSelect does not seem to be suitable for finding methods by name. My solution is to create a parallel search method which uses the selector name, rather than its compiled method as the block argument. You can then use (optionally with wildcards '*' and '#'), to locate methods containing specified strings. First copy , in class SystemDictionary to . The only alteration needed is to replace the line : [:sel | (aBlock value: (class compiledMethodAt: sel)) with: [:sel | (aBlock value: sel). This causes the temporary variable of the top level input block, which the user supplies, to be instantiated with the selector name rather than the actual compiled method. The second step is simply to create a method which can be sent to the global system variable , in the same way as , but which calls instead of . This is just an appropriately edited copy of , which I called . To use this new method type something like: Smalltalk browseAllSelectByName: [:methodName | 'Sens*' match: methodName printString ]. As a newcomer to SmallTalk myself, I can't promise that this is the "best" way to achieve this result, but...... it works. -- nick INTERNET: JurascheckNH%cs.bham.ac.uk@cunyvm.cuny.edu JANET: JurascheckNH@uk.ac.bham.cs UUCP: ...!mcvax!bhamcs!JurascheckNH BITNET: JurascheckNH%cs.bham.ac.uk@ukacrl.bitnet