[Newbies] Re: new and initialize
ron at usmedrec.com
Wed May 11 00:03:07 UTC 2016
From: Joseph Alotta
Sent: Tuesday, May 10, 2016 3:38 PM
> On May 10, 2016, at 12:45 PM, Ron Teitelbaum [via Smalltalk] <[hidden email]> wrote:
> Hi Joe,
> Excellent question. Try this.
> Object new.
> Highlight it and do debug it. Click "Into" to go into the #new method.
> Notice the implementation of #new.
> You should be able to see there that #initialize is called automatically.
> Also for extra points notice what class new is implemented on.
[Ron Teitelbaum] Exactly!
> What method should you call to skip initialize?
[Ron Teitelbaum] Excellent!
More questions: why isn’t there a command key for debug it?
[Ron Teitelbaum] No clue.
why isn’t my initialize method not running or running without setting variables?
[Ron Teitelbaum] put a halt in your method and run it. See if the initialize is being called at all. If it is then check the content of your method for errors. If not then your initialize method is spelled wrong, is not on the instance side, or there is a new method implemented in your class or a superclass that is bypassing the default implementation of #new which is a bad thing. The system gives you a warning to let you know that!! J
All the best,
View this message in context: Re: new and initialize <http://forum.world.st/new-and-initialize-tp4894227p4894237.html>
Sent from the Squeak - Beginners mailing list archive <http://forum.world.st/Squeak-Beginners-f107673.html> at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners