Properties bug or feature?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Properties bug or feature?

Schwab,Wilhelm K
Hello all,

I had/have a problem with some objects not disappearing.  My current
theory is that it started when I used properties to add an aspect or two
to some base system classes.

Here is some code that illustrates the condition:

newOne := PropertyTestA new.
newOne
        b:(
                PropertyTestB new
                        a: newOne;
                        yourself
        );
        yourself.
^newOne

#a, #a: are written in terms of a property named #a.  After creating the
PropetyTestA instance, it and the PropertyTestB instance are stuck in a
cycle that does not break.

Clearly one can write a #release or otherwise arrange to break the
cycle.  In my case, closing would be a reasonable time to do so.  Would
you favor that or possibly suclassing something like ReadStream to add
an instance variable?  The new aspects would be available only with the
customized stream, but I have unit tests that would catch most of that.
  In fact, it was tests that lead to most of this.

Does this sound like a bug in PropertyManager or just a consequence of
stretching it a little too far?  Full source for the example is
available on request.

Have a good one,

Bill


--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Properties bug or feature?

Bill Dargel
Bill Schwab wrote:
> Does this sound like a bug in PropertyManager or just a consequence of
> stretching it a little too far?  

The general problem, of which this is an example, can be solved by using
Ephemerons. Something that VisualWorks added with VW7. There's a beta
implementation for Squeak described at
http://map1.squeakfoundation.org/sm/package/fe2a35f5-3f97-431e-8596-58e810aa3c72 
  though it requires changes to the garbage collector in the VM.

Andy, Blair -- any plans for Ephemerons in Dolphin?

--
Bill Dargel            [hidden email]
Shoshana Technologies
100 West Joy Road, Ann Arbor, MI 48105  USA


Reply | Threaded
Open this post in threaded view
|

Re: Properties bug or feature?

Schwab,Wilhelm K
Bill,

>> Does this sound like a bug in PropertyManager or just a consequence of
>> stretching it a little too far?  
>
>
> The general problem, of which this is an example, can be solved by using
> Ephemerons. Something that VisualWorks added with VW7. There's a beta
> implementation for Squeak described at
> http://map1.squeakfoundation.org/sm/package/fe2a35f5-3f97-431e-8596-58e810aa3c72 
>  though it requires changes to the garbage collector in the VM.

Thanks for the link!  Needing a solution in the present, I briefly
considered reversing a decision to eliminate an arguement to quite a few
methods, and then subclassed ReadStream to add an instance variable and
accessors.  There are "many" origins of such streams in unit tests, and
ony a few in the "real" code.  Most of the changes were changes from
#readStream to #readStreamXYZ, so they will be easy to revert if I have
second thoughts.

The other option would be to stay with the property and release all
offending objects.  However, that sounds like it could easily come back
to huant me, and in ways that I don't much like in something that runs
for several weeks at a time.

With that said, any thoughts on which path represents the lesser of
evils will be gladly noted and considered.

Have a good one,

Bill

--
Wilhelm K. Schwab, Ph.D.
[hidden email]