[comp.lang.smalltalk] Mysterious appearances of Doits in V286

timm@runxtsa.runx.oz.au (Tim Menzies) (11/20/90)

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.  

Still, I'm curious. Where do  they come from? Can I  kill them safely?

--
 _--_|\  Tim Menzies (timm@runxtsa.oz)        "Two years ago, I couldn't even
/      \ HiSoft Expert Systems Group,          spell 'knowledge engineer'.
\_.--._/ 2-6 Orion Rd Lane Cove, NSW, 2d066    Now I r 1."
      v  02 9297729(voice),61 2 4280200(fax)                John McDermont

objtch@extro.ucc.su.oz.au (Peter Goodall) (11/22/90)

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.  

>Still, I'm curious. Where do  they come from? Can I  kill them safely?

Tim,
	These Doit methods are created when you execute text expressions
in workspaces and inspectors. I believe that normally they are tidied up after
a successful execution. When an error or halt happens and you close the 
debugger without resuming, the system-generated Doit methods are left where
they were created.

I think the Doit in Undefined Object is the one created by expressions in
workspaces. The others in inspectors. As far as I know removing them is OK.


----------------------------
Peter Goodall

Smalltalk Systems Consultant
ObjecTech P/L
162 Burns Bay Rd,
LANE COVE , NSW, AUSTRALIA
objtch@extro.ucc.su.oz.au

graver@gull.cis.ufl.edu (Justin Graver) (11/22/90)

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

new@ee.udel.edu (Darren New) (11/27/90)

In article <25546@uflorida.cis.ufl.EDU> graver@gull.cis.ufl.edu (Justin Graver) writes:
>	5.  if all goes well, the fake method is removed and the
>		result object is returned as the result of the "doit"

And in Smalltalk-80, you can say
  Smalltalk forgetDoIts
to get rid of these errant methods.
-- 
--- Darren New --- Grad Student --- CIS --- Univ. of Delaware ---
----- Network Protocols, Graphics, Programming Languages, 
      Formal Description Techniques (esp. Estelle), Coffee, Amigas -----
              =+=+=+ Let GROPE be an N-tuple where ... +=+=+=