Ptr and ForeignPtr Questions

Ashley Yakeley ashley@semantic.org
Thu, 20 Sep 2001 02:54:54 -0700


At 2001-09-20 02:46, Simon Marlow wrote:

>No, it's not safe.  The reason is that the compiler can track a
>ForeignPtr to discover when it dies, in order to run the finalizer, but
>it can't track a Ptr.  As soon as you drop all references to the
>ForeignPtr then the finalizer will run, even if you converted it to a
>Ptr and you're still using it.

OK, there are different types of safety. The risk here is that the 
finalisers may have been called by the time you use the Ptr. But if you 
don't mind that, for instance, if for some reason the finalisers don't 
render the Ptr invalid, I assume you can still use the Ptr.

-- 
Ashley Yakeley, Seattle WA