[squeak-dev] Is it an ok pattern to store live objects in a classVariableNames: Variable?

Jakob Reschke jakres+squeak at gmail.com
Mon Oct 25 22:17:41 UTC 2021


Hi Timothy,

I suppose the same arguments as to global variables in general apply.

Watch out for memory leaks if the objects in your collections may end
up being unused.

Regarding your term of "live" objects, if you mean that they are
mutable, there is nothing wrong with that. Another typical use of a
class variable is a registry of instances, such as ChangeSet
AllChangeSets.

Kind regards,
Jakob

Am Mo., 25. Okt. 2021 um 21:49 Uhr schrieb gettimothy via Squeak-dev
<squeak-dev at lists.squeakfoundation.org>:
>
> Namespaces := Dictionary new.
> Namespaces
> add: (-2) -> OrderedCollection new;
>       add: (-1) -> OrderedCollection new;
>       add: (0) -> OrderedCollection new;
>       add: (1) -> OrderedCollection new;
>       add: (2) -> OrderedCollection new;
>       add: (3) -> OrderedCollection new;
>       add: (4) -> OrderedCollection new;
>       add: (5) -> OrderedCollection new;
>       add: (6) -> OrderedCollection new;
>
>
> Hi Folks,
>
> I am going to be adding a lot of objects to the ordered collections in that dictionary.
>
> Basically, this is a Class pointing to a large number of Objects.
>
> Is that a good place to put them?
>
> I need these things to persist in image after shut-down.
>
>
> Thx in advance.
>
> t
>
>
>
>
>
>
>
>
>
>
>


More information about the Squeak-dev mailing list