Alternative Design for Finalisation

Simon Marlow simonmar@microsoft.com
Fri, 21 Sep 2001 10:36:26 +0100


> OK, you are saying that the ForeignObj# is a representation=20
> of a 'Ptr a',=20
> but in a way such that the compiler can't optimise away the=20
> box. Is that=20
> correct?

Yes, that's right.

> Could ForeignPtr be generalised so that its ForeignObj# could=20
> represent any type, rather than just a Ptr?

Unfortunately no.  The ForeignObj# type is unlifted, which means it
doesn't have _|_ as a possible value.  The same restrictions as for
unboxed types apply: you can't instantiate a polymorphic type variable
with ForeignObj#, or indeed any primitive type.

Cheers,
	Simon