[m-rev.] for review: split up term.m

Zoltan Somogyi zoltan.somogyi at runbox.com
Wed Jan 28 16:01:18 AEDT 2015


We have already discussed the split-up, but I would like review
comments, from anyone, about the name of the new module,
term_conversion.m. (Note that only four modules in the entire
Mercury system import it, so splitting it off seems like a good idea.)

I would also like comments about how we should go about fixing
the problems I noted in term.m. Since the reordering in term.m
yields a diff that is bigger than term.m, I have attached the
new term.m as well. It has a bunch of XXXs noting problems,
which fall into three main categories:

- Many predicates have argument orders that predate state var notation
  and don't work well with it.
- Some have names that are simply not very meaningful.
- And some predicates duplicate the functionality of other predicates.

None can be fixed without breaking backward compatibility.

I propose that we fix the second and third problems by picking
a good name for each predicate, whether it is an existing name
for the job or not, moving the implementation to that name,
make any existing predicates that do that job forward to the
one with the good name, and mark the old predicate names
as obsolete.

If the good names are new names, then we can make the new
predicate use a state-var-friendly order of arguments. I think
we can do this in most or all cases, by picking names that explicitly
name *what* they work on. For example, instead of apply_renaming,
make it apply_renaming_to_term, and instead of apply_renaming_to_list,
make it apply_renaming_to_terms.

I don't intend to commit the attached diff; I intend to commit only
an updated version that resolves these issues. For that, I await
your comments.

Zoltan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Log.term_conversion
Type: application/octet-stream
Size: 882 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20150128/56f9a864/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DIFF.term_conversion
Type: application/octet-stream
Size: 87605 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20150128/56f9a864/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: term.m
Type: text/x-objcsrc
Size: 40154 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20150128/56f9a864/attachment.bin>


More information about the reviews mailing list