SimonM:
>> > In GHC, when we allowed finalizers to be attached to any object 
>> > rather than being restricted to ForeignPtr (then ForeignObj), we 
>> > thought we might be able to do away with ForeignPtr altogether, and
>> > just attach finalizers to Ptr (then Addr).

Alastair:
>> This may be one of the best arguments advanced so far for Haskell
>> finalizers.  (It doesn't make it any easier to implement them but
>> it at least gives us some motivation to want to do so.)

SimonM:
> I may be a bit slow today (it's Friday afternoon after all) but I
> don't follow you... could you elaborate?

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.

(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.)


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

Reply via email to