[mercury-users] type_desc vs. type_info

Zoltan Somogyi zs at csse.unimelb.edu.au
Mon Oct 30 15:18:40 AEDT 2006


On 30-Oct-2006, Michael Day <mikeday at yeslogic.com> wrote:
> >No. The type "type_desc" is a user-level version of a "type_info",
> >which is a system level object. Their representations are very similar,
> >but not identical.
> 
> What is the meaning of this in the context of the use case that I 
> mentioned: calling a polymorphic Mercury predicate from C level code?
> 
> Specifically, taking a type_desc with type_of/1, passing it down in to 
> some C code that will pass it back as the argument of a polymorphic 
> Mercury predicate. In the past, type_of returned a type_info, now it 
> returns a type_desc. Does this mean that the code is now broken?

See the comment at the top of runtime/mercury_type_desc.h in the Mercury
implementation.

For now, what you are doing now will work, and is the best that can be done.
It would break in the future if some change caused the representations of
type_infos and type_descs to diverge, but we currently have no such plans.

We could introduce a version of type_of that returned a type_info instead
of a type_desc, which would be more future-proof. Would that satisfy your
requirements?

Zoltan.
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list