[Newbies] Re: new and initialize

Ben Coman btc at openinworld.com
Tue May 10 23:05:05 UTC 2016


On Wed, May 11, 2016 at 3:37 AM, Joseph Alotta <joseph.alotta at gmail.com> wrote:
>
>> 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.
>
> Behavior
>
>>  What method should you call to skip initialize?
>
> basicNew
>
> More questions:
>                  why isn’t my initialize method not running or running
> without setting variables?

Is your initialize method on the class-side or the instance-side ?
At the very very start of using Squeak this would catch me up.  It
soon became instinctive to notice which side I was working on.

cheers -ben


More information about the Beginners mailing list