Interview with InformIT part 2/3

Leandro Lucarella luca at llucax.com.ar
Thu Aug 19 08:28:56 PDT 2010


Walter Bright, el 18 de agosto a las 15:31 me escribiste:
> 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.

Exactly, manually pinning is really completely unpractical, the analogy
between pure and pinned makes very little sense.

I can see some very very weird use case where you want to arbitrarily
mark some block pinned, but I think manual unpinning is just to
dangerous to be useful. And for the former, you can easily force pinning
by having a pointer to it in a portion of memory that is scanned
conservatively.

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
Y2K
<Aztech_> hmm, nothing major has happend, what an anticlimax
<CaPS> yeah
<CaPS> really sucks
<CaPS> I expected for Australia to sink into the sea or something
<CaPS> but nnoooooooo


More information about the Digitalmars-d-announce mailing list