I've also chosen ifNil route.
However, in that case you either:
- break encapsulation by providing accessors
- have to invoke initializing method in every method that uses class
instance variables or class variables
27.08.2014 20:31, kilon.alios [via Smalltalk] написав(ла):
> yeah python does not need initialisation for class variables like it
> does for instance variables, but then same applies for instance
> variables, for example you can add instance variables and even instance
> method after the instance is created , pharo does something similar too.
>
> Well OOP is a deep subject and this is an advanced topic that I would
> not want to put in an introductionary chapter.
>
> I had issues with initialise on class side recently where i was told i
> had to initialise the class myself instead I chose to go down the ifNil
> route and initialise my class variables inside other methods. This way
> I avoided the creation of an initialise method, and probably i will
> avoid using it in the future too. From what I see most classes
> (metaclasses) dont use an initialise method either.
>
>> On Wed, Aug 27, 2014 at 7:33 PM, webwarrior <[hidden email]> ------------------------------------------------------------------------
> </user/SendEmail.jtp?type=node&node=4775110&i=0>> wrote:
>
> class-side initialize.
>
> I don't think it can be considered a metaprogramming in Smalltalk.
>
> In Python, yes, messing with metaclass is metaprogramming. But things
> are a bit different there and metaclasses are very rarely used
> [explicitly].
>
> 27.08.2014 19:05, kilon.alios [via Smalltalk] написав(ла):
>
> > 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 .
>> View this message in context: Re: Unintuitive behavior of class-side> <http://forum.world.st/Unintuitive-behavior-of-class-side-initialize-tp4775042p4775103.html>
> initialize> Sent from the Pharo Smalltalk Users mailing list archive> <http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html> at
> Nabble.com.>> http://forum.world.st/Unintuitive-behavior-of-class-side-initialize-tp4775042p4775110.html
>
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> To unsubscribe from Unintuitive behavior of class-side initialize, click
> here
> <
> NAML
> <http://forum.world.st/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
View this message in context: Re: Unintuitive behavior of class-side initialize
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Free forum by Nabble | Edit this page |