On Aug 5, 2012, at 11:57 PM, Igor Stasenko wrote: > On 5 August 2012 23:37, Stéphane Ducasse <[email protected]> wrote: >> I have the impression that you will need a finer order at least for the >> kernel. >> so putting >>> SomeClass>>startUp: quitting >>> <systemShutdown: #kernel priority: 1000> >>> self blahblah. >> >> looks to me the way to go and yes we should clean that part two. >> >> Now what is the gain to have pragma and not just a class side method >> returning a number? >> >> Stef >> > the downside of it, that you apparently more slower than explicit > subscription (you have to scan > over all methods with such pragma).
yes this is why I propose sending a message but may be you have to send a message to all classes so this is bad too. > > i cannot remember what solution i proposed.. ah ok.. i recall. > i proposed to introduce a session-awareness. i.e. an object holds a > reference to a session object > and before each access to its some session-specific resource it should > check if session has changed or not. > and if session is obsolete, then you know that you must reinitialize > (meaning do a startup). > this is what i did in NB: it does not registering for startup, but > instead it initializing at first attempt to use it. So if nobody using > it, nothing happens (means no extra cycles burned at startup for > nothing). > This also solves nicely a problem with priority of service initialization: > - imagine service A requires service B to function, > but user code attempts to access a service A first. Now since service > A will try to access a service B first, > as result, a service B will be naturally (re)initialized first. > Like that, you don't even need to think (or make sure), who should be > (re)initialized first, because chain of priority automatically adjusts > itself according to program flow. Yes this is more modular. > > -- > Best regards, > Igor Stasenko. >
