structstype system by looking inside foreign terms to get the address, or use
functor/3to get the type. This has two negative effects: firstly, if the
structspackage should change its representation of foreign terms, your code will not work. But more importantly, you are more likely to get type mismatches, and likely to get unwrapped terms or even doubly wrapped terms where you expect wrapped ones.
fred(123456)is not of type
fred, but a pointer to
fred. Looked at another way, what resides in memory at address 123456 is of type
pointer(opaque)because you want to view that pointer to be opaque, when you get something of this type, it will be printed as
opaque(456123). This is not very informative. It is better to declare
fred = opaque, thing = struct([…, part:pointer(fred), … ]).
so that when you get the contents of the
part member of a
thing, it is