dimanche 15 janvier 2017

uniqueInstance on Seaside Smalltalk

I'm trying to implement the Singleton pattern on Seaside. Here is my code:

        uniqueInstance
            uniqueInstance ifNil: [ uniqueInstance := self createInstance].
            ^ uniqueInstance

    createInstance
        ^ self basicNew

initialize
    users:= OrderedCollection new.

On the instance side I have users that is the instance variable. When I call Application uniqueInstance initialize works but, when I inspect the users variable, it said "Identity Set" instead of anOrderedCollection.

Can anybody give me a solution to my mistake?

Thank you in advance.

Aucun commentaire:

Enregistrer un commentaire