Yes, session management is cross-cutting concern, so it makes sense to
have it in the system, and not just as a NB feature.

Object new, is a cool workaround for the unique ID!

Fernando

On Mon, Oct 8, 2012 at 8:33 AM, Marcus Denker <[email protected]> wrote:
> Hello,
>
> Yes, this sounds good.
>
>         Marcus
>
> On Oct 8, 2012, at 5:11 AM, Igor Stasenko <[email protected]> wrote:
>
>> I wanna have this:
>>
>> SmalltalkImage>>snapshot: save andQuit: quit
>> ...
>> resuming ifTrue: [ session := self newSession ].
>> ...
>>
>> (where session is additional instance variable of SmalltalkImage).
>>
>> SmalltalkImage>>newSession
>> "Just answer unique object, which never can be identical to any
>> previous session object,
>> this is all what we need for detecting session change.
>> A session object don't needs to carry any state (we have plenty of
>> other objects in image which can do this for us). it just needs to be
>> unique"
>>
>>  ^ Object new.
>>
>> SmalltalkImage>>session
>> ^ session
>>
>> then, i can write in own code:
>>
>> Smalltalk session == mySession ifFalse: [  self initForNewSession.
>> mySession := Smalltalk session ]
>>
>> So, basically, this little addition allows you to detect whether
>> session changed or not between
>> two different calls to your code (given that you remembered the
>> previous session somewhere).
>> Currently we don't have such feature, and looking how some existing
>> code deals with session management,
>> i see how it can be simplified.
>> If you want to do something similar today, you will need to register
>> in startup list.. which IMO stinks ;)
>>
>> i don't like using startup lists, since you never know , what is the
>> right order of resource initialization,
>> and what inter-dependencies they may form, and changing dependencies
>> over time will require changing startup order, again and again. Not
>> fun.
>> This technique allows you to lazily re-initialize any of your
>> object(s) due to session change, once the control flow hits your code,
>> but not before.
>> (so you don't have to do all accounting at image startup time, you
>> doing it only when it required/requested, which means shorter image
>> startup time).
>>
>> The notion of session is highly important for external resource management.
>>
>> I using it in NativeBoost from very beginning, and wanna propose to
>> use it globally.
>>
>>
>> --
>> Best regards,
>> Igor Stasenko.
>>
>
> --
> Marcus Denker -- http://marcusdenker.de
>
>

Reply via email to