Safe reference counting cannot be implemented as a library

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Tue Oct 27 18:13:25 PDT 2015


On 10/27/2015 11:10 AM, 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.


It's not just safety. If the compiler knows that reference counting is going on, 
it can potentially elide a lot of the overhead. If it is faced with an arbitrary 
library solution, it only has a worm's eye view of it, and cannot do higher 
level optimizations.


More information about the Digitalmars-d mailing list