Path: utzoo!attcan!uunet!seismo!dimacs.rutgers.edu!rutgers!mit-eddie!bu.edu!xylogics!transfer!crackers!m2c!umvlsi!dime!dime.cs.umass.edu!moss From: moss@cs.umass.edu (Eliot Moss) Newsgroups: comp.lang.smalltalk Subject: Re: Show a method name Message-ID: Date: 13 Jul 90 13:32:52 GMT References: <20310@grebyn.com> Sender: news@dime.cs.umass.edu Reply-To: moss@cs.umass.edu Organization: Dept of Comp and Info Sci, Univ of Mass (Amherst) Lines: 25 In-reply-to: schultz@grebyn.com's message of 13 Jul 90 12:00:10 GMT It's not trivial to find a method's name from within the method, but since you (of course) *know* the name you can simply return it, i.e., if the method is foo, you simply write: ^ #foo Now if you want to try to find out the method's name otherwise, you have to go through the receiver's class, superclass, super-superclass, etc., scan each class's method table for the method in question, and then grab the name from the parallel part of the method table. Even this could, I suppose, fail under strange circumstances (e.g., the method has been since recompiled, and the version you are running is reachable only from contexts (stack frames) that involed it before the recompilation). There may be existing Smalltalk code for discovering the name of the method; in fact, there must be, since the system prints out nice stack backtraces. I'd start with the implementation of Object|halt (the breakpoint method) and track down the stack backtrace code. Best of luck! Eliot -- J. Eliot B. Moss, Assistant Professor Department of Computer and Information Science Lederle Graduate Research Center University of Massachusetts Amherst, MA 01003 (413) 545-4206; Moss@cs.umass.edu