Singletons (was: Re: [squeak-dev] TheWorldMainDockingBar instance)

Hannes Hirzel hannes.hirzel at
Mon Nov 8 16:12:10 UTC 2010

Sorry I wanted to write

> TheWorldMainDockingBar instance
> to
> TheWorldMainDockingBar default

And at the same time move  the class variable which holds the
singleton to a class instance variable so that we can subclass
TheWorldMainDockingBar .

Is this possible to do this so that Monticello catches everything properly?

1) create a class instance variable  -- default
2) create the access method on the class side #default

	"Answer the receiver's instance"
	^ default
		ifNil: [default := self new]

                "in the original method it was 'super new'"

4) replace calls to
       TheWorldMainDockingBar instance
       TheWorldMainDockingBar default

5) run 'rebuild menus'  (menu label)
         TheWorldMainDockingBar updateInstances   "(message)"

6) remove the method #instance

7) remove the class variable 'Instance'

N.B. In the other thread 'TheWorldMainDockingBar' we are discussing
how to remove the hard coded reference

      TheWorldMainDockingBar default

The question is if it is OK to have something like
         MorphicProject class>>defaultWorldMenuMainDockingBar

On 11/8/10, Tobias Pape <Das.Linux at> wrote:
> Am 2010-11-08 um 15:53 schrieb Hannes Hirzel:
>> move
>> TheWorldMainDockingBar instance
>> to
>> TheWorldMainDockingBar instance
> Cant move instance: same file
> ;)
> So Long,
> 	-Tobias

More information about the Squeak-dev mailing list