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.

Reply via email to