DIP60: @nogc attribute

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 22 22:33:16 PDT 2014


On 4/22/2014 4:00 AM, Don wrote:
> It turns out to have enormous value. I will explain this in my DConf talk. A
> little preview:
> Almost all of our code at Sociomantic obeys this behaviour, and it's probably
> the most striking feature of our codebase. By "almost all" I mean probably 90%
> of our code, including all of our libraries. Not just the 5% - 10% that could
> marked as @nogc according to your DIP.
>
> The key property it ensures is, if you make N calls to the function, the number
> of GC allocations is in O(1). We don't care if makes 0 allocations or 17.

I don't really understand how dicebot's proposal ensures this property. I guess 
it'll have to wait until Dconf!

> We're not really interested in whether a function uses the GC or not, since most
> interesting functions do need to do some memory allocation.
>
> Ideally, we'd want an attribute which could applied to *all* of Phobos, except
> for some convenience functions. We have no interest in library code which
> doesn't behave in that way.




More information about the Digitalmars-d mailing list