On Sunday, 11 October 2015 at 06:10:32 UTC, Jonathan M Davis
wrote:
On Sunday, 11 October 2015 at 05:52:45 UTC, Freddy wrote:
On Saturday, 10 October 2015 at 23:25:49 UTC, Manu wrote:
[...]
Speaking of DIP74 can't we just wrap a class in a struct with
use reference counting with and use alias this?
alias is problematic, because it allows the class reference to
escape. opDispatch doesn't have that problem, though there may
be other complications that it introduces (I don't know). It
does get kind of complicated though when you consider member
functions which return the a reference to the object and things
like that. So, while it's generally feasible, it's not that
hard for it to become unsafe. How much that matters is
debatable, but it could make it so that reference counting
classes is infeasible in @safe code.
- Jonathan M Davis
Ok dispatch has that problem. You can escape the this pointer
from within member functions. Always. There is no @safe reference
counting without language support. Either the RC is backed into
the language (DIP74) or ownership is baked into the language, so
that RC can be baked into the library.