On Tuesday, 27 October 2015 at 18:10:18 UTC, deadalnix wrote:
I've made the claim that we should implement reference counting
as a library many time, so I think I should explicit my
position. Indeed, RC require some level a compiler support to
be safe. That being said, the support does not need to be
specific to RC. On fact, my position is that the language
should provide some basic mechanism on top of which safe RC can
be implemented, as a library.
The problem at hand here is escape analysis. The compiler must
be able to ensure that a reference doesn't escape the RC
mechanism in an uncontrolled manner. I'd like to add such
mechanism to the language rather than bake in reference
counting, as it can be used to solve other problem we are
facing today (@nogc exception for instance).
Here's a link to the reference safety system I proposed some
months ago:
http://forum.dlang.org/post/[email protected]
I'm very far from having the expertise needed to know whether it
would be worth its weight in practice, but it was better to write
it out than to keep it bottled up in my head. I hope it will be
of some use.