Login  Register

Re: Unintuitive behavior of class-side initialize

Posted by Ben Coman on Aug 27, 2014; 5:58pm
URL: https://forum.world.st/Unintuitive-behavior-of-class-side-initialize-tp4775042p4775113.html

webwarrior wrote:

> As class is just an object in Smalltalk, it would be reasonable to believe
> that #initialize message is always sent to class on creation.
>
> However, that's not true. It is only sent to classes that redefine
> #initialize. Also sending super initialize may lead to problems.
>
> None of these is mentioned in documentation (I assume Pahro By Example is
> the official one). It only says that #initialize is sent when class is
> loaded into memory.
>
> I think either this behavior should be made more consistent, or excplicitly
> mentioned in the docs.
>
>
>
> --
> View this message in context: http://forum.world.st/Unintuitive-behavior-of-class-side-initialize-tp4775042.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>
>  
Sometimes when I type "initialize" as a new method and hit <Enter>, it
auto adds in "super initialize" as a template.  Perhaps on the class
side it should auto add a comment saying "Do not call super initialize
on the class side"

cheers -ben