[m-rev.] for review: avoid using some "keywords" 5

Zoltan Somogyi zoltan.somogyi at runbox.com
Wed May 18 09:58:09 AEST 2016


On Mon, 16 May 2016 11:28:50 +1000 (AEST), Julien Fischer <jfischer at opturion.com> wrote:
> > Since "uni" is too easily confused with both "unify" and "unique",
> > how about replacing "uni_mode" with "arg_mode" or "sub_mode",
> > with a similar substitution applied to "uni_insts", "uni_insts_lhs_rhs"
> > and "from_to_uni_mode"?
> >
> > "arg_mode" sounds more appropriate, but that type name is already
> > taken. We could rename the old arg_mode type to e.g. arg_top_mode
> 
> arg_unify_mode?  (I don't like arg_mode as it no longer mentions unify.)

This discussion prompted me to go look and see what the reason is
for the difference in structure between unify_mode and uni_mode
in terms of where they put the arrow(s). Turns out, there isn't one :-(
The real difference was more subtle: with uni_mode, the initial and final
insts of both the lhs and the rhs was always directly available, while with
unify_mode, it could require a lookup in the mode table.

Having direct access to the initial and final insts is good for the overall
mode of the unification, not just for the mode of the arguments,
so this revised diff makes it directly available in unify_modes. It then deletes
the uni_mode type, and replaces its uses with the updated unify_mode type,
eliminating a confusing and now-unnecessary difference.

> I think renaming the existing arg_mode ==> arg_top_mode would be
> desirable independent of this.

The attached diff renames it to top_functor_mode, since I think that is
even more descriptive.

For review by anyone. The main parts that need review are the type
changes in prog_data.m and hlds_goal.m (for aesthetics) and modecheck_unify.m,
unify_gen.m and ml_unify_gen.m (for correctness).

Zoltan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Log.avoid5a
Type: application/octet-stream
Size: 3506 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20160518/bd9705d5/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DIFF.avoid5a
Type: application/octet-stream
Size: 382678 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20160518/bd9705d5/attachment-0003.obj>


More information about the reviews mailing list