When a metaclass is initialised by the system ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

When a metaclass is initialised by the system ?

kilon.alios
I have read that a metaclass (class side of the class) is initialised when its loaded to the image by monticello, Are there any other cases when the initialize method of the the metaclass is being called ?
Reply | Threaded
Open this post in threaded view
|

Re: When a metaclass is initialised by the system ?

Sven Van Caekenberghe-2
Hi Dimitris,

> On 07 Dec 2015, at 23:12, Dimitris Chloupis <[hidden email]> wrote:
>
> I have read that a metaclass (class side of the class) is initialised when its loaded to the image by monticello, Are there any other cases when the initialize method of the the metaclass is being called ?

Correct: a class #initialize is called when its code is loaded, but only if it is not yet present or different in source code from what is already present (this last point will bite you one day ;-).

Else, the #initialize should be called manually (for example to reload some caches, or reset some system state). This sometimes happens in #postLoads or install scripts.

I am not aware of any automatic invocations.

Sven




Reply | Threaded
Open this post in threaded view
|

Re: When a metaclass is initialised by the system ?

kilon.alios
ok that means  I cannot rely on it and I will have to initialize my class variables in specific methods. No problem, ifNil here I come :)

On Tue, Dec 8, 2015 at 12:24 AM Sven Van Caekenberghe <[hidden email]> wrote:
Hi Dimitris,

> On 07 Dec 2015, at 23:12, Dimitris Chloupis <[hidden email]> wrote:
>
> I have read that a metaclass (class side of the class) is initialised when its loaded to the image by monticello, Are there any other cases when the initialize method of the the metaclass is being called ?

Correct: a class #initialize is called when its code is loaded, but only if it is not yet present or different in source code from what is already present (this last point will bite you one day ;-).

Else, the #initialize should be called manually (for example to reload some caches, or reset some system state). This sometimes happens in #postLoads or install scripts.

I am not aware of any automatic invocations.

Sven




Reply | Threaded
Open this post in threaded view
|

Re: When a metaclass is initialised by the system ?

Mariano Martinez Peck
Dimitris,

Relying in class side initialize is not very cool. Mostly, because it's hard to know EXACTLY when Monticello will send it. For sure it's the first time you load that class. But then it could be if such method changes again. But maybe too if you clear some Monticello caches...
Also, you may have dependencies (of order execution) with other class side initialize.  So...another approaches you can take (depending on your needs) is lazy class var getters with ifNil:   or  if you have a ConfigurationOfYourApp, you can define #postLoadDoIts in which you can perform the whole initialization of your app. Or ...from the #postLoadDoIts simply delegate to a class MyAppInitialize.

I do a bit of all of them hahaha.

Cheers,

On Mon, Dec 7, 2015 at 9:11 PM, Dimitris Chloupis <[hidden email]> wrote:
ok that means  I cannot rely on it and I will have to initialize my class variables in specific methods. No problem, ifNil here I come :)

On Tue, Dec 8, 2015 at 12:24 AM Sven Van Caekenberghe <[hidden email]> wrote:
Hi Dimitris,

> On 07 Dec 2015, at 23:12, Dimitris Chloupis <[hidden email]> wrote:
>
> I have read that a metaclass (class side of the class) is initialised when its loaded to the image by monticello, Are there any other cases when the initialize method of the the metaclass is being called ?

Correct: a class #initialize is called when its code is loaded, but only if it is not yet present or different in source code from what is already present (this last point will bite you one day ;-).

Else, the #initialize should be called manually (for example to reload some caches, or reset some system state). This sometimes happens in #postLoads or install scripts.

I am not aware of any automatic invocations.

Sven







--
Reply | Threaded
Open this post in threaded view
|

Re: When a metaclass is initialised by the system ?

demarey
yes, we miss a package initialize method ...

Le 8 déc. 2015 à 16:35, Mariano Martinez Peck a écrit :

Dimitris,

Relying in class side initialize is not very cool. Mostly, because it's hard to know EXACTLY when Monticello will send it. For sure it's the first time you load that class. But then it could be if such method changes again. But maybe too if you clear some Monticello caches...
Also, you may have dependencies (of order execution) with other class side initialize.  So...another approaches you can take (depending on your needs) is lazy class var getters with ifNil:   or  if you have a ConfigurationOfYourApp, you can define #postLoadDoIts in which you can perform the whole initialization of your app. Or ...from the #postLoadDoIts simply delegate to a class MyAppInitialize.

I do a bit of all of them hahaha.

Cheers,

On Mon, Dec 7, 2015 at 9:11 PM, Dimitris Chloupis <[hidden email]> wrote:
ok that means  I cannot rely on it and I will have to initialize my class variables in specific methods. No problem, ifNil here I come :)

On Tue, Dec 8, 2015 at 12:24 AM Sven Van Caekenberghe <[hidden email]> wrote:
Hi Dimitris,

> On 07 Dec 2015, at 23:12, Dimitris Chloupis <[hidden email]> wrote:
>
> I have read that a metaclass (class side of the class) is initialised when its loaded to the image by monticello, Are there any other cases when the initialize method of the the metaclass is being called ?

Correct: a class #initialize is called when its code is loaded, but only if it is not yet present or different in source code from what is already present (this last point will bite you one day ;-).

Else, the #initialize should be called manually (for example to reload some caches, or reset some system state). This sometimes happens in #postLoads or install scripts.

I am not aware of any automatic invocations.

Sven







--


smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: When a metaclass is initialised by the system ?

kilon.alios

What about slots ? Do they have any special initialiazation ?

On Tue, 8 Dec 2015 at 17:54, Christophe Demarey <[hidden email]> wrote:
yes, we miss a package initialize method ...

Le 8 déc. 2015 à 16:35, Mariano Martinez Peck a écrit :

Dimitris,

Relying in class side initialize is not very cool. Mostly, because it's hard to know EXACTLY when Monticello will send it. For sure it's the first time you load that class. But then it could be if such method changes again. But maybe too if you clear some Monticello caches...
Also, you may have dependencies (of order execution) with other class side initialize.  So...another approaches you can take (depending on your needs) is lazy class var getters with ifNil:   or  if you have a ConfigurationOfYourApp, you can define #postLoadDoIts in which you can perform the whole initialization of your app. Or ...from the #postLoadDoIts simply delegate to a class MyAppInitialize.

I do a bit of all of them hahaha.

Cheers,

On Mon, Dec 7, 2015 at 9:11 PM, Dimitris Chloupis <[hidden email]> wrote:
ok that means  I cannot rely on it and I will have to initialize my class variables in specific methods. No problem, ifNil here I come :)

On Tue, Dec 8, 2015 at 12:24 AM Sven Van Caekenberghe <[hidden email]> wrote:
Hi Dimitris,

> On 07 Dec 2015, at 23:12, Dimitris Chloupis <[hidden email]> wrote:
>
> I have read that a metaclass (class side of the class) is initialised when its loaded to the image by monticello, Are there any other cases when the initialize method of the the metaclass is being called ?

Correct: a class #initialize is called when its code is loaded, but only if it is not yet present or different in source code from what is already present (this last point will bite you one day ;-).

Else, the #initialize should be called manually (for example to reload some caches, or reset some system state). This sometimes happens in #postLoads or install scripts.

I am not aware of any automatic invocations.

Sven







--

Reply | Threaded
Open this post in threaded view
|

Re: When a metaclass is initialised by the system ?

Thierry Goubier
In reply to this post by demarey
Le 08/12/2015 16:53, Christophe Demarey a écrit :
> yes, we miss a package initialize method ...

FileTree, GitFileTree and probably Monticello have support for a package
initialize method.

Now, when I was doing my browser, I wondered about giving access to such
code... turns out nobody uses it.

Thierry

>
> Le 8 déc. 2015 à 16:35, Mariano Martinez Peck a écrit :
>
>> Dimitris,
>>
>> Relying in class side initialize is not very cool. Mostly, because
>> it's hard to know EXACTLY when Monticello will send it. For sure it's
>> the first time you load that class. But then it could be if such
>> method changes again. But maybe too if you clear some Monticello caches...
>> Also, you may have dependencies (of order execution) with other class
>> side initialize.  So...another approaches you can take (depending on
>> your needs) is lazy class var getters with ifNil:   or  if you have a
>> ConfigurationOfYourApp, you can define #postLoadDoIts in which you can
>> perform the whole initialization of your app. Or ...from the
>> #postLoadDoIts simply delegate to a class MyAppInitialize.
>>
>> I do a bit of all of them hahaha.
>>
>> Cheers,
>>
>> On Mon, Dec 7, 2015 at 9:11 PM, Dimitris Chloupis
>> <[hidden email] <mailto:[hidden email]>> wrote:
>>
>>     ok that means  I cannot rely on it and I will have to initialize
>>     my class variables in specific methods. No problem, ifNil here I
>>     come :)
>>
>>     On Tue, Dec 8, 2015 at 12:24 AM Sven Van Caekenberghe
>>     <[hidden email] <mailto:[hidden email]>> wrote:
>>
>>         Hi Dimitris,
>>
>>         > On 07 Dec 2015, at 23:12, Dimitris Chloupis
>>         <[hidden email] <mailto:[hidden email]>> wrote:
>>         >
>>         > I have read that a metaclass (class side of the class) is
>>         initialised when its loaded to the image by monticello, Are
>>         there any other cases when the initialize method of the the
>>         metaclass is being called ?
>>
>>         Correct: a class #initialize is called when its code is
>>         loaded, but only if it is not yet present or different in
>>         source code from what is already present (this last point will
>>         bite you one day ;-).
>>
>>         Else, the #initialize should be called manually (for example
>>         to reload some caches, or reset some system state). This
>>         sometimes happens in #postLoads or install scripts.
>>
>>         I am not aware of any automatic invocations.
>>
>>         Sven
>>
>>
>>
>>
>>
>>
>>
>> --
>> Mariano
>> http://marianopeck.wordpress.com <http://marianopeck.wordpress.com/>
>


Reply | Threaded
Open this post in threaded view
|

Re: When a metaclass is initialised by the system ?

Mariano Martinez Peck


On Tue, Dec 8, 2015 at 6:23 PM, Thierry Goubier <[hidden email]> wrote:
Le 08/12/2015 16:53, Christophe Demarey a écrit :
yes, we miss a package initialize method ...

FileTree, GitFileTree and probably Monticello have support for a package initialize method.



mmmmmm package initialize method in Monticello?  I never saw that. Could you share more details please?

 
Now, when I was doing my browser, I wondered about giving access to such code... turns out nobody uses it.

Thierry


Le 8 déc. 2015 à 16:35, Mariano Martinez Peck a écrit :

Dimitris,

Relying in class side initialize is not very cool. Mostly, because
it's hard to know EXACTLY when Monticello will send it. For sure it's
the first time you load that class. But then it could be if such
method changes again. But maybe too if you clear some Monticello caches...
Also, you may have dependencies (of order execution) with other class
side initialize.  So...another approaches you can take (depending on
your needs) is lazy class var getters with ifNil:   or  if you have a
ConfigurationOfYourApp, you can define #postLoadDoIts in which you can
perform the whole initialization of your app. Or ...from the
#postLoadDoIts simply delegate to a class MyAppInitialize.

I do a bit of all of them hahaha.

Cheers,

On Mon, Dec 7, 2015 at 9:11 PM, Dimitris Chloupis
<[hidden email] <mailto:[hidden email]>> wrote:

    ok that means  I cannot rely on it and I will have to initialize
    my class variables in specific methods. No problem, ifNil here I
    come :)

    On Tue, Dec 8, 2015 at 12:24 AM Sven Van Caekenberghe
    <[hidden email] <mailto:[hidden email]>> wrote:

        Hi Dimitris,

        > On 07 Dec 2015, at 23:12, Dimitris Chloupis
        <[hidden email] <mailto:[hidden email]>> wrote:
        >
        > I have read that a metaclass (class side of the class) is
        initialised when its loaded to the image by monticello, Are
        there any other cases when the initialize method of the the
        metaclass is being called ?

        Correct: a class #initialize is called when its code is
        loaded, but only if it is not yet present or different in
        source code from what is already present (this last point will
        bite you one day ;-).

        Else, the #initialize should be called manually (for example
        to reload some caches, or reset some system state). This
        sometimes happens in #postLoads or install scripts.

        I am not aware of any automatic invocations.

        Sven







--
Mariano
http://marianopeck.wordpress.com <http://marianopeck.wordpress.com/>






--
Reply | Threaded
Open this post in threaded view
|

Re: When a metaclass is initialised by the system ?

Thierry Goubier
Le 09/12/2015 00:15, Mariano Martinez Peck a écrit :

>
>
> On Tue, Dec 8, 2015 at 6:23 PM, Thierry Goubier
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     Le 08/12/2015 16:53, Christophe Demarey a écrit :
>
>         yes, we miss a package initialize method ...
>
>
>     FileTree, GitFileTree and probably Monticello have support for a
>     package initialize method.
>
>
>
> mmmmmm package initialize method in Monticello?  I never saw that. Could
> you share more details please?

What I see is the following files that are checked when loading a
FileTree or GitFileTree package:

#('initializers*' 'preamble.st' 'postscript.st' 'preambleOfRemoval*'
'postscriptOfRemoval*')

As far as I can follow the code, initializers relates to class
initialization (calls to the various class initializers are written there?).

Package initialize would be postscript.st.

Thierry

>
>     Now, when I was doing my browser, I wondered about giving access to
>     such code... turns out nobody uses it.
>
>     Thierry
>
>
>         Le 8 déc. 2015 à 16:35, Mariano Martinez Peck a écrit :
>
>             Dimitris,
>
>             Relying in class side initialize is not very cool. Mostly,
>             because
>             it's hard to know EXACTLY when Monticello will send it. For
>             sure it's
>             the first time you load that class. But then it could be if such
>             method changes again. But maybe too if you clear some
>             Monticello caches...
>             Also, you may have dependencies (of order execution) with
>             other class
>             side initialize.  So...another approaches you can take
>             (depending on
>             your needs) is lazy class var getters with ifNil:   or  if
>             you have a
>             ConfigurationOfYourApp, you can define #postLoadDoIts in
>             which you can
>             perform the whole initialization of your app. Or ...from the
>             #postLoadDoIts simply delegate to a class MyAppInitialize.
>
>             I do a bit of all of them hahaha.
>
>             Cheers,
>
>             On Mon, Dec 7, 2015 at 9:11 PM, Dimitris Chloupis
>             <[hidden email] <mailto:[hidden email]>
>             <mailto:[hidden email]
>             <mailto:[hidden email]>>> wrote:
>
>                  ok that means  I cannot rely on it and I will have to
>             initialize
>                  my class variables in specific methods. No problem,
>             ifNil here I
>                  come :)
>
>                  On Tue, Dec 8, 2015 at 12:24 AM Sven Van Caekenberghe
>                  <[hidden email] <mailto:[hidden email]>
>             <mailto:[hidden email] <mailto:[hidden email]>>> wrote:
>
>                      Hi Dimitris,
>
>                      > On 07 Dec 2015, at 23:12, Dimitris Chloupis
>                      <[hidden email]
>             <mailto:[hidden email]> <mailto:[hidden email]
>             <mailto:[hidden email]>>> wrote:
>                      >
>                      > I have read that a metaclass (class side of the
>             class) is
>                      initialised when its loaded to the image by
>             monticello, Are
>                      there any other cases when the initialize method of
>             the the
>                      metaclass is being called ?
>
>                      Correct: a class #initialize is called when its code is
>                      loaded, but only if it is not yet present or
>             different in
>                      source code from what is already present (this last
>             point will
>                      bite you one day ;-).
>
>                      Else, the #initialize should be called manually
>             (for example
>                      to reload some caches, or reset some system state).
>             This
>                      sometimes happens in #postLoads or install scripts.
>
>                      I am not aware of any automatic invocations.
>
>                      Sven
>
>
>
>
>
>
>
>             --
>             Mariano
>             http://marianopeck.wordpress.com
>             <http://marianopeck.wordpress.com/>
>
>
>
>
>
>
>
> --
> Mariano
> http://marianopeck.wordpress.com


Reply | Threaded
Open this post in threaded view
|

Re: When a metaclass is initialised by the system ?

stepharo
In reply to this post by demarey
It would be good to add a preLoad and postLoad hook in the Manifest

Stef

Le 8/12/15 16:53, Christophe Demarey a écrit :
yes, we miss a package initialize method ...

Le 8 déc. 2015 à 16:35, Mariano Martinez Peck a écrit :

Dimitris,

Relying in class side initialize is not very cool. Mostly, because it's hard to know EXACTLY when Monticello will send it. For sure it's the first time you load that class. But then it could be if such method changes again. But maybe too if you clear some Monticello caches...
Also, you may have dependencies (of order execution) with other class side initialize.  So...another approaches you can take (depending on your needs) is lazy class var getters with ifNil:   or  if you have a ConfigurationOfYourApp, you can define #postLoadDoIts in which you can perform the whole initialization of your app. Or ...from the #postLoadDoIts simply delegate to a class MyAppInitialize.

I do a bit of all of them hahaha.

Cheers,

On Mon, Dec 7, 2015 at 9:11 PM, Dimitris Chloupis <[hidden email]> wrote:
ok that means  I cannot rely on it and I will have to initialize my class variables in specific methods. No problem, ifNil here I come :)

On Tue, Dec 8, 2015 at 12:24 AM Sven Van Caekenberghe <[hidden email]> wrote:
Hi Dimitris,

> On 07 Dec 2015, at 23:12, Dimitris Chloupis <[hidden email]> wrote:
>
> I have read that a metaclass (class side of the class) is initialised when its loaded to the image by monticello, Are there any other cases when the initialize method of the the metaclass is being called ?

Correct: a class #initialize is called when its code is loaded, but only if it is not yet present or different in source code from what is already present (this last point will bite you one day ;-).

Else, the #initialize should be called manually (for example to reload some caches, or reset some system state). This sometimes happens in #postLoads or install scripts.

I am not aware of any automatic invocations.

Sven







--


Reply | Threaded
Open this post in threaded view
|

Re: When a metaclass is initialised by the system ?

Thierry Goubier
Le 09/12/2015 11:22, stepharo a écrit :
> It would be good to add a preLoad and postLoad hook in the Manifest

+1

Thierry

> Stef
>
> Le 8/12/15 16:53, Christophe Demarey a écrit :
>> yes, we miss a package initialize method ...
>>
>> Le 8 déc. 2015 à 16:35, Mariano Martinez Peck a écrit :
>>
>>> Dimitris,
>>>
>>> Relying in class side initialize is not very cool. Mostly, because
>>> it's hard to know EXACTLY when Monticello will send it. For sure it's
>>> the first time you load that class. But then it could be if such
>>> method changes again. But maybe too if you clear some Monticello
>>> caches...
>>> Also, you may have dependencies (of order execution) with other class
>>> side initialize. So...another approaches you can take (depending on
>>> your needs) is lazy class var getters with ifNil:   or  if you have a
>>> ConfigurationOfYourApp, you can define #postLoadDoIts in which you
>>> can perform the whole initialization of your app. Or ...from the
>>> #postLoadDoIts simply delegate to a class MyAppInitialize.
>>>
>>> I do a bit of all of them hahaha.
>>>
>>> Cheers,
>>>
>>> On Mon, Dec 7, 2015 at 9:11 PM, Dimitris Chloupis
>>> <<mailto:[hidden email]>[hidden email]> wrote:
>>>
>>>     ok that means  I cannot rely on it and I will have to initialize
>>>     my class variables in specific methods. No problem, ifNil here I
>>>     come :)
>>>
>>>     On Tue, Dec 8, 2015 at 12:24 AM Sven Van Caekenberghe
>>>     <<mailto:[hidden email]>[hidden email]> wrote:
>>>
>>>         Hi Dimitris,
>>>
>>>         > On 07 Dec 2015, at 23:12, Dimitris Chloupis
>>>         <[hidden email] <mailto:[hidden email]>> wrote:
>>>         >
>>>         > I have read that a metaclass (class side of the class) is
>>>         initialised when its loaded to the image by monticello, Are
>>>         there any other cases when the initialize method of the the
>>>         metaclass is being called ?
>>>
>>>         Correct: a class #initialize is called when its code is
>>>         loaded, but only if it is not yet present or different in
>>>         source code from what is already present (this last point
>>>         will bite you one day ;-).
>>>
>>>         Else, the #initialize should be called manually (for example
>>>         to reload some caches, or reset some system state). This
>>>         sometimes happens in #postLoads or install scripts.
>>>
>>>         I am not aware of any automatic invocations.
>>>
>>>         Sven
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> Mariano
>>> http://marianopeck.wordpress.com <http://marianopeck.wordpress.com/>
>>
>