[Pharo-users] Updating a project and NIL class variables

Dimitris Chloupis kilon.alios at gmail.com
Wed Jan 20 09:46:42 EST 2016


no apologies owed, I just asked because I want to make sure Pharo wont do
anything weird behind my back :)

On Wed, Jan 20, 2016 at 4:39 PM Sven Van Caekenberghe <sven at stfx.eu> wrote:

>
> > On 20 Jan 2016, at 15:34, Dimitris Chloupis <kilon.alios at gmail.com>
> wrote:
> >
> > Thank you for the info but I think I did not make myself clear because
> you say "remain nil"
> >
> > Ok Imagine a class SomeClass and that class has a variable we will call
> SomeVariable, class variable that is
> > , there is no class initialize method, now that class has a method that
> is eventually called ,
> > someMethod
> >
> > SomeVariable ifNil: [ SomeVariable := 'hello world']
> >
> > so when I decide to update this class via metacello loading the latest
> version from github ,  SomeVariable will have the value 'hello world'
> >
> > My question is , will SomeVariable after I do the update revert back to
> nil  or stay 'hello world' ?
> >
> > If your answer is no, and it stays 'hello world' then yes i need an
> initialize method and call it at update time.
>
> Argh, I should have said: keeps it value, will not revert to nil.
>
> Sorry for the confusion !
>
> > On Wed, Jan 20, 2016 at 2:54 PM Sven Van Caekenberghe <sven at stfx.eu>
> wrote:
> > They remain nil.
> >
> > That is why #initialize on the class side is needed.
> >
> > You can call that explicitly in a post load script, or rely on the class
> loading mechanism that normally calls #initialize automatically when
> loading a class. The warning is: this only happens when the *source* code
> of the #initialize methods changes. So sometimes, you will have to touch
> that method to force it.
> >
> > I hope that makes sense.
> >
> > See MCMethodDefinition>>#postloadOver:
> >
> > > On 20 Jan 2016, at 13:41, Dimitris Chloupis <kilon.alios at gmail.com>
> wrote:
> > >
> > > So my question is this , I have a class with nil variables that are
> lazy initialised only when needed the first time and of course they keep
> their values from there on.
> > >
> > > Lets say I get the latest update from github via metacello over an
> older update that I already have inside the image , do those variables
> revert back to nil values ? or do they keep their values as they are ?
> >
> >
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20160120/5978e490/attachment.html>


More information about the Pharo-users mailing list