[m-rev.] for review: start implementing RTTI in Mercury

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Aug 17 20:52:21 AEST 2001


On 17-Aug-2001, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> On 17-Aug-2001, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > Are you worried about efficiency,
> > i.e. the overhead of exception handling?
> > If so, then I think this is premature optimization.
> 
> Yes I was worried about efficiency, but if you think it is premature
> then I will put it into C#.

Good, thanks.

Another alternative would be to write it using
equality comparisons on the result of System.Object::GetType(),
e.g. something like the following:

	% XXX this is untested
  :- pragma foreign_proc("C#",
  	get_type_ctor_info(TypeInfo::in, TypeCtorInfo::out), [],
  "
	if (TypeInfo[0].GetType() == TypeInfo.GetType()) {
		TypeCtorInfo = (object[]) TypeInfo[0];
	} else {
		TypeCtorInfo = TypeInfo;
	}
  ").


> +:- pragma foreign_decl("C#", "
> +
> +	enum type_ctor_info_field_nums {
> +		type_ctor_rep = 4,
> +		type_ctor_module_name = 7,
> +		type_ctor_name = 8,
> +		type_layout = 11
> +	}

A comment there would be nice.

Otherwise the relative diff looks fine.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list