Re: [Newbies] Re: Re: A do with ONLY index? (plus, . a style question)

2007-02-10 Thread Michael van der Gulik

Blake wrote:

On Fri, 09 Feb 2007 02:54:14 -0800, Klaus D. Witzel  
[EMAIL PROTECTED] wrote:



Why doesn't this:

^ self basicNew initialize

cause a DNU? Object doesn't have an initialize method.



Really ? :) It is inherited from ProtoObject ;-)



Wow, don't know how I missed that.

I guess maybe partly because the debugger doesn't go into the method  
(because it's blank, I suppose).


Actually, the method isn't blank, it's actually ^ self, except that 
that part is added automatically and you don't see it.


See here: 
http://users.ipa.net/~dwighth/smalltalk/bluebook/bluebook_chapter27.html#CompiledMethods27


One of the optimisations in Smalltalk is that a method that's just ^ 
self actually doesn't have any bytecodes but just a special flag in the 
method header. Glossing over a few details, the Interpreter picks this 
up and skips over it.


It's interesting to play with the right-most button on the Browser - 
click it and see the bytecodes or the decompilation of source.


Michael.
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: Re: A do with ONLY index? (plus,. a style question)

2007-02-09 Thread Klaus D. Witzel

Hi Blake,

on Fri, 09 Feb 2007 09:15:43 +0100, you wrote:


On Thu, 08 Feb 2007 22:58:32 -0800, Klaus D. Witzel wrote:

Sure. Evaluate Object halt; new with doIt and then in the debugger,  
in the DoIt method line push the buttons Through then Into.


Aha.

Huh.

Why doesn't this:

^ self basicNew initialize

cause a DNU? Object doesn't have an initialize method.


Really ? :) It is inherited from ProtoObject ;-)

/Klaus

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners