[Glass] Weird problem with class instance variable

Mariano Martinez Peck via Glass glass at lists.gemtalksystems.com
Tue Aug 25 13:30:11 PDT 2015


On Tue, Aug 25, 2015 at 5:25 PM, Jon Paynter <kittle31 at gmail.com> wrote:

> I suspect what you want is a regular class variable vs a class Instance
> variable.
> Is there a reason why you chose class Instance instead?
>

Hi Jon, I was thinking the same.
I don't have a strong point. But in Pharo, for this type of instVar for
tracking instances, I usually used a Class Instance Variable rather than
Class Variable and never had an issue. Technically yes, I could use a class
var instead.

Even if I could use a class var in this case, aren't Class Instance
Variables not working properly in GemStone? Or I am doing something wrong?
Just to know for the future.

BTW I forgot to said that classHistory size was 1.

Thanks in advance,




>
> On Tue, Aug 25, 2015 at 1:03 PM, Mariano Martinez Peck via Glass <
> glass at lists.gemtalksystems.com> wrote:
>
>> Hi guys,
>>
>> I define a classInstVars: called 'Instances' to keep track of new
>> persistent instances in my class FaBackgroundProcess. Of course, I
>> implement #new to add those there.
>>
>> But I am having a very strange issue now. I have this accessor:
>>
>> FaBackgroundProccess class >> instances
>> ^ Instances ifNil: [ Instances := OrderedCollection new ]
>> If I execute:
>>
>> FaBackgroundProcess instances ->>>>>  anOrderedCollection( )
>>
>> I get an empty collection (which is what I expect). However, if I inspect
>> the class FaBackgroundProcess and see the slot for 'Instances' I see lots
>> of instances of FaBackgroundProcess! (when I expect to see same as the
>> answer of #instances, that is, empty) And those instances are really alive
>> as they prevent GC of other objects.
>>
>> So...what is going on????  I attach an screenshot with all the pieces.
>> Any help is really welcome since I am lost.
>>
>> Thanks in advance,
>>
>> --
>> Mariano
>> http://marianopeck.wordpress.com
>>
>> _______________________________________________
>> Glass mailing list
>> Glass at lists.gemtalksystems.com
>> http://lists.gemtalksystems.com/mailman/listinfo/glass
>>
>>
>


-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20150825/883486f2/attachment.html>


More information about the Glass mailing list