Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!wuarchive!mit-eddie!uw-beaver!uw-june!jmaloney From: jmaloney@cs.washington.edu (John Maloney) Newsgroups: comp.lang.smalltalk Subject: Re: recognizing instances in Smalltalk/V Message-ID: <12955@june.cs.washington.edu> Date: 5 Sep 90 00:07:48 GMT Organization: U of Washington, Computer Science, Seattle Lines: 31 Suppose object A has the method "webster" defined as: webster ^webster Then "A perform: 'webster' asSymbol" should do the trick. If it didn't work for then perhaps you are sending the "perform:" message to the wrong object (in your example you sent it to "self" but maybe "self" wasn't the object that had "webster" defined? Just a guess.) The other thing you can do is: A instVarAt: index where "index" is the index of the instance variable "webster" in object A. You can find the proper index using: index := (A class allInstVarNames) indexOf: 'webster' Using "instVarAt:" does not even require you to have defined the method for "webster". What you are doing is intentionally breaking the object encapsulation of Smalltalk. There are times when this is justified--for example, the debugger and inspector tools use this trick-- but you should be really sure that this is the only way to do what you want to do. Why not simply keep a dictionary of name->value bindings in your object and implement a "getValueOf: aName" message to look up the values? This info is for Smalltalk-80; ST/V might differ. Good luck. -- John