[m-rev.] for review: field names and higher order values in the debugger
Fergus Henderson
fjh at cs.mu.OZ.AU
Wed Dec 19 11:38:42 AEDT 2001
On 18-Dec-2001, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
>
> Allow the browser to refer to fields by name, and allow the debugger to print
> higher order values.
It would be better to handle those as two separate changes.
> library/std_util.m:
> Add new predicates named_argument and det_named_argument. They are
> implemented using ML_named_arg, a new C function which is the same
> as ML_arg except that it specifies the selected argument by name.
These should be mentioned in the NEWS file.
> runtime/mercury_ml_expand_body.h:
> Add a new alternative, EXPAND_NAMED_ARG, for use in implementing
> ML_named_arg.
>
> Deconstruct closures as if they were ordinary terms, with the function
> symbol being the name of the predicate/function and the arguments being
> the terms stored in the closure.
Allowing deconstruction of closures breaks referential transparency for
std_util__deconstruct and the like.
> +++ runtime/mercury_ml_expand_body.h 2001/12/18 03:33:42
> @@ -549,8 +621,88 @@
>
> case MR_TYPECTOR_REP_PRED:
> /* XXX expand_info->non_canonical_type = TRUE; */
After your change, the code inside the comment there is needed.
> std_util.m:
> + % named_argument(Data, ArgumentName) = ArgumentUniv
> + %
> + % Same as argument, except the chosen argument is specified by giving
s at argument@argument/2@
> + % det_named_argument(Data, ArgumentName) = ArgumentUniv
> + %
> + % Same as named_argyment/2, except that for cases where
s/y/u/
> +:- pragma foreign_proc("C#",
> + named_argument(_Term::in, _ArgumentName::in) = (_ArgumentUniv::out),
> + [will_not_call_mercury], "
> +{
> + mercury.runtime.Errors.SORRY(""foreign code for argument"");
> + // XXX this is required to keep the C# compiler quiet
> + SUCCESS_INDICATOR = false;
> +}").
It would be better to write that as Mercury code,
like I did in private_builtin.m.
> +++ runtime/mercury_ml_expand_body.h 2001/12/18 03:33:42
> @@ -43,6 +43,10 @@
> ** argument, chosen, and it will fill in the fields
> ** of the ML_Expand_Chosen_Arg_Only structure.
> **
> +** EXPAND_NAMED_ARG If defined, the function will have an extra
> +** argument, chosen_name, and it will fill in the
> +** fields of the ML_Expand_Chosen_Arg_Only structure.
The documentation should explain the semantics of the extra argument.
--
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