deRefStablePtr exception?

Alastair Reid reid at cs.utah.edu
Thu Jun 13 07:43:40 EDT 2002


> But you seem to be saying that
>
> 	freeStablePtr (castPtrToStablePtr Ptr.nullPtr)
>
> is meaningful... which part of the spec implies that?

Aha!  I was reading the last sentence of the freeStablePtr description
as though it applied to freeStablePtr when in fact it means that
castStablePtrToPtr is guaranteed not to diverge.  Well that's a lot
easier to implement.

btw What am I to make of the parenthetical remark 

  (in particular it may be Ptr.nullPtr)

Should I read that as a recommendation to implementors that when
casting a stableptr which has already been freed then they should
return nullPtr?   If so, is this required or just hinted/recommended?

> Either 'ErrorCall "Foreign.StablePtr.deRefStablePtr: invalid stable
> pointer"', or a new exception.  I don't mind which.

I'll pick one and add my choice to the spec then.

-- 
Alastair Reid        reid at cs.utah.edu        http://www.cs.utah.edu/~reid/



More information about the FFI mailing list