[m-dev.] for review: Aditi updates[3]
Fergus Henderson
fjh at cs.mu.OZ.AU
Sat Jun 26 21:02:03 AEST 1999
On 05-Jun-1999, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
make_hlds.m:
> @@ -4194,13 +4183,23 @@
> { update_qual_info(Info0, TVarSet0, VarTypes0, PredId, Info1) },
> { varset__merge_subst(VarSet0, CVarSet, VarSet1, Subst) },
> transform(Subst, HeadVars, Args, Body, VarSet1, Context,
> - Goal, VarSet, Warnings, Info1, Info),
> - % XXX we should avoid append - this gives O(N*N)
> - { list__append(ClauseList0, [clause(ModeIds, Goal, Context)],
> - ClauseList) },
> - { qual_info_get_var_types(Info, VarTypes) },
> - { ClausesInfo = clauses_info(VarSet, VarTypes, VarTypes1,
> - HeadVars, ClauseList) }.
> + Goal, VarSet, Warnings, Info1, Info2),
> + { qual_info_get_found_syntax_error(Info2, FoundError) },
> + { qual_info_set_found_syntax_error(no, Info2, Info) },
> + (
> + { FoundError = yes },
> + % Don't report spurious type errors for clauses
> + % containing other errors.
> + { ClausesInfo = ClausesInfo0 }
I think it would be better if the comment here explained things
in a bit more detail. The comment above makes it sound like
the alternative would be to report spurious type errors here;
but the alternative here is to insert the clause into the clauses_info,
which may later result in some other code (typecheck.m) reporting
spurious type errors. So something like the following would be
better.
%
% Don't insert clauses containing syntax errors into
% the clauses_info, because doing that would cause
% typecheck.m to report spurious type errors.
%
...
> +:- pred transform_aditi_builtin(string, list(prog_term), prog_context,
> + prog_varset, hlds_goal, prog_varset,
> + qual_info, qual_info, io__state, io__state).
> +:- mode transform_aditi_builtin(in(aditi_update_str), in,
> + in, in, out, out, in, out, di, uo) is det.
Please add some comments to the definition of this predicate.
> +:- pred transform_delete_or_modify(string, list(prog_term), prog_context,
> + prog_varset, hlds_goal, prog_varset,
> + qual_info, qual_info, io__state, io__state).
> +:- mode transform_delete_or_modify(in(aditi_del_or_mod_str), in,
> + in, in, out, out, in, out, di, uo) is det.
Likewise for this one (there were a couple of comments, but there was
still plenty of code that was unexplained and not immediately obvious).
> +transform_delete_or_modify(DelOrMod, Args0, Context, VarSet0,
> + UpdateGoal, VarSet, Info0, Info) -->
...
> + % First syntax -
> + % aditi_modify((p(X0, Y0, _DB0) = p(X0, Y, _DB) :-
> + % X0 < 100, Y = Y0 + 1), DB0, DB).
I don't much like the use of `=' here. I think `==>' or something like
that would be better.
> Index: compiler/modecheck_call.m
[To be continued...]
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list