Path: utzoo!attcan!uunet!mcvax!ukc!strath-cs!glasgow!kww From: kww@cs.glasgow.ac.uk (Mr Kevin Waite) Newsgroups: comp.lang.smalltalk Subject: Smalltalk goodie Keywords: Smalltalk goodie Message-ID: <1620@crete.cs.glasgow.ac.uk> Date: 8 Sep 88 19:07:28 GMT Organization: Computing Sci, Glasgow Univ, Scotland Lines: 32 The following chunk of Smalltalk provides a facility that I find useful to leave lying around in my System Workspace. Given a Class Category name (in this example it is 'DataType-Tools') all the methods belonging to classes in this category that have NO senders are collected. A method browser is then opened on this collection. This provides a convenient way of discovering old, obsolete methods which can be browsed and removed if required. Note however that the utility is very slow. The utility was developed under ParcPlace V2.2. ("Click inside the bracket to browse all unused methods in the given category." | classNames classes unused senders | classNames _ SystemOrganization listAtCategoryNamed: 'DataType-Tools' asSymbol. classes _ classNames collect: [:className | Smalltalk at: className]. unused _ SortedCollection new. classes do: [:cl | cl selectors do: [:sel | senders _ Smalltalk allCallsOn: sel. senders size = 0 ifTrue: [unused add: cl name , ' ' , sel]] ]. BrowserView openListBrowserOn: unused label: 'Methods with no senders'.) --------- Puzzle: Why are there so few postings of useful classes and goodies to this group? I thought the whole idea was to share code. :-) -- --------- Kevin Waite: kww@cs.glasgow.ac.uk Department of Computing Science, University of Glasgow. 17 Lilybank Gardens, Glasgow, United Kingdom, G12 8RZ.