malcolm-ffi@cs.york.ac.uk wrote,
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?
I think, I like `ForeignPtr'. Semantically, it makes sense given that these pointers are usually used for foreign ADTs. Manuel