It is good to have this new feature, but since Parent-Child relationships
are found all over the place ( at least in my code they are ) and the
scenarios presented seem to me anything but "rare" - am I alone in thinking
that the way this feature was implemented is a "fudge" ? :


a) because it loses the typing information - it is generic for all objects.
This adds to tedium as one has to apply lots of casting.

b) the amount of coding involved to create and deal with this object.

A much better solution would have been to use "Weak" instead of Dim in
source code, and for properties to have a checkbox named "weak", making all
the mechanics of handling weak references internal. Current references I
would bet are some form of hidden C++ "smart-pointer" object, and so should
weak references be.

I think that to leave WeakRef as a class, partly to prevent people from
wrongly using this feature everywhere, is misplaced.  By all means present
warnings during syntax check ( turn-offable in preferences ) to warn where
they are used,  but for a professional tool,  I think it is bad form to make
a language feature unnecessarily hard and tedious to use, simply to prevent
beginners from over-using this feature.


On 11/4/07 12:05, "Mathieu Langlois" <[EMAIL PROTECTED]> wrote:

> That's the idea.  If your Eggs have a weak reference to the carton, then you
> don't need to worry about anything, when the carton gets out of scope in
> your code, it will get destroyed along with all the eggs it contains.
> 
> Math
> 
> On 4/11/07, Stephen Dodd <[EMAIL PROTECTED]> wrote:
>> 
>> Are circular references never destroyed and garbage collected?
>> 
>> In Aaron's nice little intro to 2007r2
>> (
>> http://www.rblibrary.com/rblibrary/index.php?main_page=product_info&products_
>> id=81
>> ),
>> he mentions the dangers of circular references stopping objects from
>> being destroyed (and the use of WeakRef to get around it.)
>> 
>> Let's look at an example:
>> 
>> EggCarton object contains 12 Egg objects (as properties)
>> Each Egg contains a reference to the parent EggCarton
>> 
>> If my program creates and destroys EggCartons containing Eggs, will I
>> 'leak' memory unless I use WeakRef?  (Assume only the EggCarton
>> references Eggs.)
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
> 
> Search the archives:
> <http://support.realsoftware.com/listarchives/lists.html>
> 

Regards,

Dan



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to