RE: [Newbies] new and initialize

2016-05-10 Thread Ron Teitelbaum
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.  What method 
should you call to skip initialize?

All the best,

Ron Teitelbaum



> -Original Message-
> From: beginners-boun...@lists.squeakfoundation.org [mailto:beginners-
> boun...@lists.squeakfoundation.org] On Behalf Of Joseph Alotta
> Sent: Tuesday, May 10, 2016 2:07 PM
> To: beginners@lists.squeakfoundation.org
> Subject: [Newbies] new and initialize
> 
> Greetings,
> 
> I have an instance method called ‘initialize’ that defines instance variables.
> 
> I want it to run whenever a new instance is created.  How do I accomplish
> that?
> 
> I tried to add a class method ‘new’  that contained ^(super new) initialize.
> But it warned me about adding the message saying it would have serious
> effects.
> 
> So where do I put it?
> 
> Sincerely,
> 
> Joe.
> 
> 
> 
> ___
> Beginners mailing list
> Beginners@lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

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


Re: [Newbies] new and initialize

2016-05-12 Thread Tobias Pape

On 12.05.2016, at 01:50, Joseph Alotta  wrote:

> Sorry, it doesn’t work on the Mac.  The window gets black and then redraws.  
> I think maybe it means “refresh”. 
> 
> Sincerely, 
> 
> JOe. 

Joe, which version of Squeak are you using?
5.0 does not yet have this shortcut but the current development version (trunk 
/ 5.1alpha) does.

Best regards
-Tobias


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