The non allocating D subset

Simen Kjaeraas simen.kjaras at gmail.com
Fri Jun 7 07:46:13 PDT 2013


On Fri, 07 Jun 2013 16:39:15 +0200, Tyler Jameson Little  
<beatgammit at gmail.com> wrote:

>> If the nogc marker could be used to overload functions then Phobos may  
>> include both versions of the code - GC and non GC - as some code may  
>> run faster under GC. The calling function would pick up the right one.
>
> I can't imagine how this would work without over-complicating the  
> syntax. Any ideas?

I don't understand what you mean. This is how that would work:

void foo() {}       // #1, Not @nogc.
@nogc void foo() {} // #2.

void bar() {
     foo(); // Calls #1.
}

@nogc void baz() {
     foo(); // calls #2.
}

-- 
Simen


More information about the Digitalmars-d mailing list