[m-dev.] cvs diff: type_info code.

Fergus Henderson fjh at cs.mu.oz.au
Mon Apr 21 12:02:46 AEST 1997

Tyson Richard DOWD wrote:
> > > +	 * If the substituted type parameters from the term_type_info
> > > +	 * were type variables, they will be replaced with references
> > > +	 * to the unnamed type (''/0).
> > 
> > I don't understand why that is done and I don't think it should be done.
> If the type variables remain unbound, we can either
> 	- replace them with references to ''
> 	- replace them with NULL pointers, and check for null pointers
> 	  in any code that uses type_infos or univs, then act
> 	  appropriately

I discussed this with Tyson.  Summary:

	- Conceptually speaking, type variables will never be unbound
	  at runtime.  They will always be bound.  This is currently
	  done by polymorphism.m (although it might be better to do
	  it in typecheck.m).

	- Currently the representation of the type_info for the unnamed
	  type (which we should probably name `void') used by polymorphism.m
	  and a few places in the Mercury runtime is as a null type_info
	  pointer.  This however is inefficient and error-prone, so
	  using a more standard representation would be a better idea.
	- The code which Tyson's comment above refers to actually
	  just converts between the null-pointer representation and
	  a more standard representation.

	- It would be best to use the standard representation
	  at all times rather than introducing the null pointer
	  representation in polymorphism.m and then later converting
	  it in the runtime.

	- For the moment, Tyson will change the just comment to an "XXX"
	  with an appropriate explanation.

Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at         |     -- the last words of T. S. Garp.

More information about the developers mailing list