More radical ideas about gc and reference counting

John Colvin via Digitalmars-d digitalmars-d at puremagic.com
Mon May 12 03:59:53 PDT 2014


On Monday, 12 May 2014 at 10:51:33 UTC, Marco Leise wrote:

> Time will tell if all "well written" D libraries will be @nogc
> to move the question of allocations to the user.

If there was such a thing as "weakly &nogc" then we would could 
do this

//some library function
void foo(OR, IR)(OR o, IR i) @weak-nogc
{
     //take things from i and put them in o
}

allocations would be possible during the execution of foo, but 
*only* in the implementations of OR and IR, which means that the 
developer gets the control and guarantees they need, but doesn't 
have to explicitly pre-allocate (which might not even be 
possible).

I don't see how it would work with UFCS though...


More information about the Digitalmars-d mailing list