ok officially I am confused are we talking about initialise at the instance side or class side (metaclass) side ? I am a python coder myself but I have not done any metaprogramming . If it is a metaprogramming thing then yes it wont go inside my intro chapter since this is advanced topic and metaprogramming is already covered by PBE on a separate chapter so that can be added there. Since I am not experienced with metaprogramming it would be better if people experienced with Pharo and metaprogramming would write the documentation . On Wed, Aug 27, 2014 at 6:16 PM, webwarrior <reg@webwarrior.ws> wrote:
This is not something fundamental to OOP, just specific to Pharo or Smalltalk.
Take for example Python. It has similar object model (objects, classes, metaclasses). Every time class is defined (either by class keyword, or by type() function, or by calling a metaclass), its metaclass' __init__ method is called. Usually you don't need to redefine metaclass' __init__ method, because class attributes are initialized in class definition. But when you do, it works as expected.
27.08.2014 15:50, kilon.alios [via Smalltalk] напиÑав(ла):
I will be adding an "Introduction to Object Orientation" chapter to the new updated Pharo By Example online book, so I will add this to the chapter. The chapter will target people not familiar with Object Orientation and people new to coding. Its not an immediate target but it will happen till the end of the year.
On Wed, Aug 27, 2014 at 3:44 PM, Mariano Martinez Peck <[hidden email] </user/SendEmail.jtp?type=node&node=4775051&i=0>> wrote:
On Wed, Aug 27, 2014 at 8:22 AM, webwarrior <[hidden email] </user/SendEmail.jtp?type=node&node=4775051&i=1>> 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.
Ohhh yes. There is always a time for every Smalltalkers where you discover that doing super for class side initialize is not a good idea. Here was my time:
http://forum.world.st/super-initialize-is-not-a-good-idea-for-Behaviors-td30...
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.
+1 to the documentation
-- View this message in context:
http://forum.world.st/Unintuitive-behavior-of-class-side-initialize-tp477504...
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
-- Mariano http://marianopeck.wordpress.com
------------------------------------------------------------------------ If you reply to this email, your message will be added to the discussion below:
http://forum.world.st/Unintuitive-behavior-of-class-side-initialize-tp477504...
To unsubscribe from Unintuitive behavior of class-side initialize, click here < NAML <
http://forum.world.st/template/NamlServlet.jtp?macro=macro_viewer&id=instant...>
------------------------------ View this message in context: Re: Unintuitive behavior of class-side initialize <http://forum.world.st/Unintuitive-behavior-of-class-side-initialize-tp477504...>
Sent from the Pharo Smalltalk Users mailing list archive <http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html> at Nabble.com.