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

gettimothy gettimothy at zoho.com
Tue Oct 26 07:33:14 UTC 2021


Thank you very much!.









---- On Mon, 25 Oct 2021 18:17:41 -0400 Jakob Reschke <jakres+squeak at gmail.com> wrote ----



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 
<mailto: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 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211026/cff88f10/attachment.html>


More information about the Squeak-dev mailing list