RFC: reference counted Throwable

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 21 11:20:45 PDT 2014


BTW hmmm what about this:

interface Foo { }

class Bar : Foo, RCObject {}

class Pwned : Foo {}

void main() {
    Foo bar = new Bar();
    /* where is bar.Release() called? */
    Foo pwned = new Pwned();
    /* better hope pwned.Release() isn't called cuz that's 
impossible */
}


I *believe* IUnknown interfaces are special and a separate 
category from regular D interfaces, so this would be statically 
disallowed.

But with the RCObject, we need to be careful about implicit 
casting to interfaces transparently killing memory safety.

of course then we might be weakening their usefulness. gah we 
just need scope references, then we can pass the interface with 
confidence that it won't be escaped. yeah yeah i know i sound 
like a broken record.


More information about the Digitalmars-d mailing list