Re: [Newbies] Re: new and initialize

2016-05-10 Thread Ben Coman
On Wed, May 11, 2016 at 3:37 AM, Joseph Alotta  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
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


RE: [Newbies] Re: new and initialize

2016-05-10 Thread Ron Teitelbaum
 

 

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. 


Behavior 

[Ron Teitelbaum] Exactly!  



>  What method should you call to skip initialize? 

basicNew 

[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,

Ron




Thank you. 

Sincerely, 

Joe. 




  _  

View this message in context: Re: new and initialize 
 
Sent from the Squeak - Beginners mailing list archive 
  at Nabble.com.

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


Re: [Newbies] Re: new and initialize

2016-05-11 Thread Chris Cunningham
Hi.

On Tue, May 10, 2016 at 12:37 PM, Joseph Alotta 
wrote:


> More questions:  why isn’t there a command key for debug it?
>

I just learned this today - we do have a command key (well, command key
sequence) for debug it:

Shift+Cmd+D to "Debug it"

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