std.utf.decode @nogc please

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sun Oct 5 07:44:52 PDT 2014


On 10/5/14, 1:58 AM, "Marc Schütz" <schuetzm at gmx.net>" wrote:
> There was indeed agreement on reference counting (although someone
> suggested disallowing cycles or removing chaining altogether). But what
> I meant is that there was no agreement on a specific solution, and
> several ones were proposed, from full general compiler supported
> refcounting to library implementation.

Understood, thanks. I think there's no other way around than language 
support. Here's a sketch of the solution:

* Introduce interface AutoRefCounted. For practical reasons it may 
inherit IUnknown, though that's not material to the concept.

* AutoRefCounted and any interface or class inheriting it have the 
compiler insert calls to methods that increment and decrement the 
reference count (e.g. AddRef/Release).

* All descendants of AutoRefCounted must be descendants of it through 
all paths (i.e. there can be no common descendants of AutoRefCounted and 
either IUnknown or Object).

* After all this infra is in place, unhook Throwable from its current 
place and have it inherit AutoRefCounted.

* All is good and there's much rejoicing.


Andrei



More information about the Digitalmars-d mailing list