RFC: moving forward with @nogc Phobos

Foo via Digitalmars-d digitalmars-d at puremagic.com
Tue Sep 30 06:39:51 PDT 2014


On Tuesday, 30 September 2014 at 13:38:43 UTC, Foo wrote:
> I hate the fact that this will produce template bloat for each 
> function/method.
> I'm also in favor of "let the user pick", but I would use a 
> global variable:
>
> ----
> enum MemoryManagementPolicy { gc, rc, mrc }
> immutable
>     gc = ResourceManagementPolicy.gc,
>     rc = ResourceManagementPolicy.rc,
>     mrc = ResourceManagementPolicy.mrc;
>
> auto RMP = gc;
> ----
>
> and in my code:
>
> ----
> RMP = rc;
> string str = "foo"; // compiler knows -> ref counted
> // ...
> RMP = gc;
> string str2 = "bar"; // normal behaviour restored
> ----

Of course each method/function in Phobos should use the global
RMP.


More information about the Digitalmars-d mailing list