More radical ideas about gc and reference counting

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Mon May 5 07:21:46 PDT 2014


Initial post in this thread makes focus on a change that does not 
fix anything and implies silent semantical breakage. I am glad 
Andrei has reconsidered it but feels like key problem is not that 
proposal itself was bad but that it does not even try to solve.

Real issue being deterministic destruction and/or deallocation of 
polymorphic objects. Class destructors are bad for that indeed. 
But I want some better replacement before prohibiting anything.

There is a very practical use case that highlights existing 
problem, it was discussed few months ago in exception performance 
thread. To speed up throwing of non-const exceptions it is 
desirable to use pool of exception objects. However currently 
there is no place where to put code for releasing object back 
into pool. One cannot use destructor because it will never be 
called if pool keeps the reference. One cannot use reference 
counting struct wrapper because breaks polymorphic catching of 
exceptions.

Any good solution to be proposed should be capable of solving 
this problem.


More information about the Digitalmars-d mailing list