[m-rev.] for review: deconstruct by functor number

Julien Fischer juliensf at csse.unimelb.edu.au
Tue Jan 2 14:03:24 AEDT 2007


On Fri, 29 Dec 2006, Simon Taylor wrote:

> Estimated hours taken: 20
> Branches: main
>
> Add support for deconstructing by functor number rather than name,
> for use by write_binary.
>
> library/deconstruct.m:
> runtime/mercury_deconstruct.h:
> runtime/mercury_deconstruct.c:
> runtime/mercury_ml_expand_body.h:
> runtime/mercury_ml_deconstruct_body.h:
> 	Add predicates deconstruct.functor_number and
> 	deconstruct.deconstruct.du, which returns a functor number
> 	suitable for use by construct.construct rather than a functor
> 	name.
>
> library/construct.m:
> library/term.m:
> browser/term_rep.m:
> 	Add a function get_functor_lex, which returns the lexicographic
> 	functor number given an ordinal functor number.
>
> 	Add equivalence types to make it clearer which ordering is
> 	being used by which functor numbers.
>
> 	Remove a C-ism: num_functors now fails rather than returning -1
> 	for types without functors.

I suggest also add det_num_functors that does the same thing except
that it throws an exception rather than failing.

>
> NEWS:
> 	Document the new predicates and functions.
>
> runtime/mercury_type_info.h:
> runtime/mercury_builtin_types.c:
> runtime/mercury_mcpp.h:
> compiler/rtti.m:
> compiler/rtti_out.m:
> compiler/type_ctor_info.m:
> compiler/rtti_to_mlds.m:
> compiler/opt_debug.m:
> 	Add a field to MR_TypeCtorInfo which contains a mapping from
> 	an ordinal functor number to a lexicographic functor number
> 	which can be passed to construct.construct.
>
> 	Bump MR_RTTI_VERSION.
>
> tests/hard_coded/expand.m:
> tests/hard_coded/expand.exp:
> tests/hard_coded/expand.exp2:
> tests/hard_coded/construct_test.m:
> tests/hard_coded/construct_test.exp:
> tests/hard_coded/construct_test_exist.m:
> tests/hard_coded/construct_test_exist.exp:
> 	Test cases.
>
> Index: NEWS
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/NEWS,v
> retrieving revision 1.433
> diff -u -u -r1.433 NEWS
> --- NEWS	21 Dec 2006 03:00:48 -0000	1.433
> +++ NEWS	28 Dec 2006 12:45:54 -0000
> @@ -40,6 +40,16 @@
> * The type software_error/0 has been moved from the require module into
>   the exception module.
>
> +* construct.num_functors now fails rather than returning -1 for types
> +  with no functors.

Append the arity to num_functors.

> +
> +* We have added predicates deconstruct.functor_number/3 and
> +  deconstruct.deconstruct_du/4 which return functor numbers suitable
> +  for use by construct.construct, rather than functor strings.
> +
> +* We have added a function construct.get_functor_lex/2 which converts
> +  an ordinal functor number into a lexicographic functor number.
> +
> Changes to the Mercury compiler:
>
> * The compiler now issues a warning when an inst declaration is not

The rest of that looks okay.  Could you please make sure that it
bootstraps in a debugging grade and a high-level C grade before
committing.

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



More information about the reviews mailing list