Blake wrote:
On Fri, 09 Feb 2007 02:54:14 -0800, Klaus D. Witzel klaus.witzel@cobss.com 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#Com...
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.