> Hmmm, on second thoughts, Ptr's are still foreign objects so any
> finalization they need could still plausibly be written in the foreign
> language.
> 
> Merging Ptr and ForeignPtr still seems like a cool idea.  One less
> type, eliminate some conversion functions between near-iromorphic
> types, easier to switch between automatic and manual reclamation.

er... but I explained why we didn't do this in GHC.  Admittedly it's
only for performance reasons - we want the compiler to be able to unbox
Ptr when it can.  But it's quite a big win.

> (Like you, I'm not enthusiastic about implementing it though...
> ForeignPtrs currently contain both an Addr# and a list of finalizers
> whereas Ptrs don't.  Off the top of my head, this implies that all
> Ptrs get bigger or that we make a linear scan through a table of all
> the Ptrs which have finalizers at the end of every GC - neither is
> especially attractive.)

ForeignPtrs don't contain a list of finalizers in GHC, the finalizers
are stored in separate heap objects.

Cheers,
        Simon
_______________________________________________
Cvs-ghc mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to