Interview with InformIT part 2/3

bearophile bearophileHUGS at lycos.com
Wed Aug 18 14:48:34 PDT 2010


Walter Bright:

> There is no need for a pin attribute, the gc can determine if a class needs 
> pinning or not.

The same is probably true for pure functions too, the compiler can determine what functions are pure and what are not pure.

But the purpose of a @pinned is that:
1) The default becomes unpinned. This is good for the GC, because moving memory around is good to compact the heap, etc.
2) The programmer states hir/her/his purpose, this is documentation, but it's an alive documentation because as with pure the compiler is able to determine if the attribute is used wrongly, and give a compile time error in such case.

Bye,
bearophile


More information about the Digitalmars-d-announce mailing list