Andrei Alexandrescu, el  3 de mayo a las 11:55 me escribiste:
> >If the array is a reference type, the array dies when the garbage
> >collector decides to run sometime after all live references to the array
> >have died, so RAII is not possible.
> 
> RAII can be implemented even with reference semantics. The mechanics would 
> involve reference counting.

I was not following this discussion, so I might be speaking out of
ignorance, but I thing you are underestimating the problems of reference
counting again.

Circular references break it, and when comes to RAII, you probably loose
the ordering guarantees it needs if you implement some kind of algorithm
to deal with cycles.

Another option is trust the program be smart enough not to create cycles
(weark references can help a lot here), but if the RC is hidden in the
language it can be a little hard to remember this restriction.

-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------

Reply via email to