Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!uflorida!gull.cis.ufl.edu!graver From: graver@gull.cis.ufl.edu (Justin Graver) Newsgroups: comp.lang.smalltalk Subject: Re: Mysterious appearances of Doits in V286 Message-ID: <25546@uflorida.cis.ufl.EDU> Date: 21 Nov 90 21:11:51 GMT References: <2562@runxtsa.runx.oz.au> Sender: news@uflorida.cis.ufl.EDU Organization: UF CIS Dept. Lines: 51 In article <2562@runxtsa.runx.oz.au> timm@runxtsa.runx.oz.au (Tim Menzies) writes: >Does anyone else get mysterious "Doit" methods appearing in their >Smalltalk/V 286 image? > >The manual says that only Undefined object has a "Doit" method >(though lord knows what it does). But my virgin Smalltak V 286 >images tells me (via Smalltalk implementersOf: #Doit) that there >are Doits in Array, Interval, etc, etc. Sometimes, in the classes >that I've created, Doits appear. I delete them and nothing >untoward happens. I can't speak for Smalltalk V 286, but for Smalltalk-80 here is the story. Whenever you select an expression and "doit" from a text menu the following scenario occurs: 1. the text controller grabs the text and sends it to the compiler to be evaluated 2. to evaluate the text string, the compiler creates a "fake" method with the selector #Doit whose body is the selected text. 3. this method is then compiled and installed in some appropriate class (usually determined by the context of the text window, e.g. a broswer) just as if it had been "accepted" in a broser 4. the compiler next creates a new instance of the appropriate class and sends it the #Doit message, saving the result, which will be eventually returned to the user. 5. if all goes well, the fake method is removed and the result object is returned as the result of the "doit" 6. however, if something goes wrong during the execution of the method, or a debugger is closed without finishing the evaluation, the fake method never gets removed from the class (hence the possibility of various rogue implementations of the #Doit method in classes throughout the image). Hope this helps. Justin Graver University of Florida E301 CSE Gainesville, FL 32611 (904) 392-1507 graver@cis.ufl.edu