
21 Sep
2001
21 Sep
'01
5:36 a.m.
OK, you are saying that the ForeignObj# is a representation of a 'Ptr a', but in a way such that the compiler can't optimise away the box. Is that correct?
Yes, that's right.
Could ForeignPtr be generalised so that its ForeignObj# could 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