Interview with InformIT part 2/3

Walter Bright newshound2 at digitalmars.com
Wed Aug 18 15:31:40 PDT 2010


bearophile wrote:
> 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.

The other problem with a pinned/notpinned object is the object itself cannot 
control who or how someone is pointing to it.


More information about the Digitalmars-d-announce mailing list