[m-rev.] for review: make deconstruct work for herbrand variables
Fergus Henderson
fjh at cs.mu.OZ.AU
Tue Jul 10 18:43:42 AEST 2001
On 10-Jul-2001, David Jeffery <dgj at cs.mu.OZ.AU> wrote:
> runtime/mercury_ml_expand_body.h:
> When expanding a value that has MR_SECTAG_VARIABLE as its primary
> tag, do not abort. Instead return "<<variable>>" as its functor,
> and treat the value as being zero-arity.
> This means that deconstruct works for values which are herbrand
> variables, and has the consequence that the debugger does not
> abort if you try to print out a herbrand variable in a HAL program.
...
> Index: runtime/mercury_ml_expand_body.h
...
> case MR_SECTAG_VARIABLE:
> - MR_fatal_error(MR_STRINGIFY(EXPAND_FUNCTION_NAME)
> - ": cannot expand variable");
> + handle_functor_name("<<variable>>");
> + handle_zero_arity_args();
> + return;
You should add `expand_info->non_canonical_type = TRUE;'
at the start of the case. Because deconstructing a term
whose inst is unknown and and figuring out whether it is
ground or not should definitely be cc_multi rather than det.
Oh wait, that will break the debugger gain, since we don't have
variants of deconstruct (etc.) that allow this. We should add
such variants, and fix the debugger to call them.
In the mean time, add it, but leave it commented out.
(Preferably with a comment explaining why.)
The "return;" statement there, buried in the middle of a very long function,
is asking for trouble.
Cheers,
Fergus.
--
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