[m-rev.] for review: pseudo-typeinfo RTTI in Mercury
Fergus Henderson
fjh at cs.mu.OZ.AU
Tue Apr 16 01:15:10 AEST 2002
On 10-Apr-2002, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
>
> compiler/rtti.m:
> Add new, purely Mercury data structures for representing typeinfos
> and pseudo-typeinfos, designed both for efficient interpretation
> and as a source for the generation of static data structures in C.
>
> compiler/pseudo_type_info.m:
> Delete the type definitions here, since they are superseded by the new
> definitions in rtti.m.
> Index: compiler/rtti.m
...
> +:- type var_arity_ctor_id
> + ---> pred_type_info
> + ; func_type_info
> + ; tuple_type_info.
> +
> +:- type rtti_type_info
> + ---> plain_arity_zero_type_info(
> + rtti_type_ctor
> + )
> + ; plain_type_info(
> + rtti_type_ctor,
> + % This list should not be empty; if it is, one should
> + % use plain_arity_zero_type_info instead.
> + list(rtti_type_info)
> + )
> + ; var_arity_type_info(
> + var_arity_ctor_id,
> + list(rtti_type_info)
> + ).
> +
> +:- type rtti_pseudo_type_info
> + ---> plain_arity_zero_pseudo_type_info(
> + rtti_type_ctor
> + )
> + ; plain_pseudo_type_info(
> + rtti_type_ctor,
> + % This list should not be empty; if it is, one should
> + % use plain_arity_zero_pseudo_type_info instead.
> + list(rtti_maybe_pseudo_type_info)
> + )
> + ; var_arity_pseudo_type_info(
> + var_arity_ctor_id,
> + list(rtti_maybe_pseudo_type_info)
> + )
> + ; type_var(int).
> +
> +:- type rtti_maybe_pseudo_type_info
> + ---> pseudo(rtti_pseudo_type_info)
> + ; plain(rtti_type_info).
> +
> +:- type rtti_maybe_pseudo_type_info_or_self
> + ---> pseudo(rtti_pseudo_type_info)
> + ; plain(rtti_type_info)
> + ; self.
These should all be documented -- what the types represent,
what each alternative constructor represents, what they're used
for, and why there is so much redundant duplication.
Also, I suggest s/var_arity_ctor_id/var_arity_type_ctor_id/
> Index: compiler/pseudo_type_info.m
> -:- type pseudo_type_info
> - ---> type_var(int)
> - % This represents a type variable.
> - % Type variables are numbered consecutively,
> - % starting from 1.
> - ; type_ctor_info(
> + % pseudo_type_info__construct_type_info(Type, TypeInfo)
> %
> - % This represents a zero-arity type,
> - % i.e. a type constructor with no arguments.
> - %
> - rtti_type_ctor
> - )
> - ; type_info(
> - %
> - % This represents a type with arity > zero,
> - % i.e. a type constructor applied to some arguments.
> - % The argument list should not be empty.
> - %
> - rtti_type_ctor,
> - list(pseudo_type_info)
> - )
> - ; higher_order_type_info(
> - %
> - % This represents a higher-order or tuple type.
> - % The rtti_type_ctor field will be pred/0,
> - % func/0 or tuple/0; the real arity is
> - % given in the arity field.
> - %
> - rtti_type_ctor,
> - arity,
> - list(pseudo_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