[m-rev.] help needed: fix rtti bug
Fergus Henderson
fjh at cs.mu.OZ.AU
Sun Dec 21 22:26:24 AEDT 2003
On 19-Dec-2003, Peter Ross <pro at missioncriticalit.com> wrote:
> Any hints on how to work out the arity of a variable arity type_ctor
> on the IL backend.
The arity is stored in the first field of the type_info;
i.e., since the type_info has type Object[], the arity
will be "(int) type_info[0]".
> +++ library/rtti_implementation.m 19 Dec 2003 10:58:51 -0000
> @@ -919,7 +919,15 @@
> type_ctor_name_and_arity(TypeCtorInfo, ModuleName, Name, Arity) :-
> ModuleName = type_ctor_module_name(TypeCtorInfo),
> Name = type_ctor_name(TypeCtorInfo),
> - Arity = type_ctor_arity(TypeCtorInfo).
> + ( type_ctor_is_variable_arity(TypeCtorInfo) ->
> + Arity = type_ctor_va_arity(TypeCtorInfo)
> + ;
> + Arity = type_ctor_arity(TypeCtorInfo)
> + ).
The interface to this predicate is wrong. Given a type_ctor, there is
no way to compute the arity. You need the type_info.
--
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