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


On Tue, Dec 8, 2015 at 6:23 PM, Thierry Goubier
<thierry.goub...@gmail.com <mailto:thierry.goub...@gmail.com>> 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
            <kilon.al...@gmail.com <mailto:kilon.al...@gmail.com>
            <mailto:kilon.al...@gmail.com
            <mailto:kilon.al...@gmail.com>>> 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
                 <s...@stfx.eu <mailto:s...@stfx.eu>
            <mailto:s...@stfx.eu <mailto:s...@stfx.eu>>> wrote:

                     Hi Dimitris,

                     > On 07 Dec 2015, at 23:12, Dimitris Chloupis
                     <kilon.al...@gmail.com
            <mailto:kilon.al...@gmail.com> <mailto:kilon.al...@gmail.com
            <mailto:kilon.al...@gmail.com>>> 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 via email to