FPtr

malcolm-ffi at cs.york.ac.uk malcolm-ffi at cs.york.ac.uk
Tue Nov 28 09:01:28 EST 2000


> Simon and I noticed this morning that ForeignObj should
> really be parameterised.  The current type of newForeignObj is
>   newForeignObj :: Ptr a -> IO () -> IO ForeignObj
> This immediately loses the type information on the Ptr!
> Shouldn't it be
>   newForeignObj :: Ptr a -> IO () -> IO (ForeignObj a)

I agree that once we adopt (Ptr a) in preference to Addr, ForeignObj
may in some cases probably also be better parameterised as well.
But *please* choose a different name (like we did with Ptr/Addr)
for backward compatibility.

> Or maybe we should shorten it to (FPtr a)?  ("F" for "finalised".)

I dislike cryptic abbreviations on principle.  "Ptr" is clear,
"FPtr" is not.  How about "FinalisedPtr" (only 2 chars longer than
"ForeignObj")?  Or indeed, "ForeignPtr", which is the same length?

Regards,
    Malcolm




More information about the FFI mailing list