[m-rev.] for review: more disambiguations
Julien Fischer
juliensf at csse.unimelb.edu.au
Wed Sep 20 18:20:47 AEST 2006
On Wed, 20 Sep 2006, Zoltan Somogyi wrote:
> Depending on how you measure it, this diff removes 3 to 5% of the ambiguities
> of procedure names in the compiler.
>
> Zoltan.
>
> Get rid of a bunch more ambiguities by renaming predicates, mostly
> in polymorphism.m, {abstract,build,ordering}_mode_constraints.m, prog_type.m,
> and opt_debug.m in the compiler directory and term_io.m, term.m, parser.m,
> and string.m in the library.
>
> In some cases, when the library and the compiler defined the same predicate
> with the same code, delete the compiler's copy and give it access to the
> library's definition by exporting the relevant predicate (in the undocumented
> part of the library module's interface).
>
> NEWS:
> Mention that the names of some library functions have changed.
>
> library/*.m:
> compiler/*.m:
> mdbcomp/*.m:
> browser/*.m:
> Make the changes mentioned above, and conform to them.
>
> test/general/string_test.m:
> test/hard_coded/string_strip.m:
> test/hard_coded/string_strip.exp:
> Conform to the above changes.
>
...
> Index: library/parser.m
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/library/parser.m,v
> retrieving revision 1.52
> diff -u -b -r1.52 parser.m
> --- library/parser.m 19 Apr 2006 05:17:54 -0000 1.52
> +++ library/parser.m 19 Sep 2006 12:00:27 -0000
> @@ -45,10 +45,6 @@
>
> %-----------------------------------------------------------------------------%
>
> - % read_term/{3,4}:
> - %
> - % Reads in (and parses) terms from the current input stream.
> -
> % read_term(Result):
> %
> % Reads a Mercury term from the current input stream.
> @@ -63,28 +59,25 @@
> :- pred read_term_with_op_table(Ops::in, read_term(T)::out, io::di, io::uo)
> is det <= op_table(Ops).
>
> - % read_term(FileName, Result):
> + % read_term_filename(FileName, Result, !IO):
> %
> % Reads a term from the current input stream. The string is the filename
> % to use for the current input stream; this is used in constructing the
> % term.contexts in the read term. This interface is used to support
> % the `:- pragma source_file' directive.
> %
> -:- pred read_term(string::in, read_term(T)::out, io::di, io::uo) is det.
> +:- pred read_term_filename(string::in, read_term(T)::out, io::di, io::uo)
> + is det.
I think read_term_from_file would be a more appropriate name. The
comment above that one looks wrong as well: it isn't reading the
term from the current input stream, it's reading it from the named
file.
> - % read_term_with_op_table(Ops, FileName, Result):
> + % read_term_filename_with_op_table(Ops, FileName, Result, !IO):
> %
> % As above but using the given op_table.
> %
> -:- pred read_term_with_op_table(Ops::in, string::in, read_term(T)::out,
> - io::di, io::uo) is det <= op_table(Ops).
> +:- pred read_term_filename_with_op_table(Ops::in, string::in,
> + read_term(T)::out, io::di, io::uo) is det <= op_table(Ops).
Likewise, I would prefer read_term_from_file_with_op_table here.
...
> Index: library/string.m
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/library/string.m,v
> retrieving revision 1.249
> diff -u -b -r1.249 string.m
> --- library/string.m 31 Aug 2006 11:09:52 -0000 1.249
> +++ library/string.m 19 Sep 2006 14:58:25 -0000
> @@ -88,9 +88,9 @@
>
> % As above, but using the supplied table of operators.
> %
> -:- func string.string(ops.table, T) = string.
> +:- func string.string_ops(ops.table, T) = string.
For consistency with most of the rest of the library that should
perhaps be string_with_op_table but that seems a little long.
...
> Index: library/term.m
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/library/term.m,v
> retrieving revision 1.121
> diff -u -b -r1.121 term.m
> --- library/term.m 20 Aug 2006 08:17:45 -0000 1.121
> +++ library/term.m 19 Sep 2006 12:35:21 -0000
> @@ -171,33 +171,33 @@
> :- type substitution(T) == map(var(T), term(T)).
> :- type substitution == substitution(generic).
>
> - % unify(Term1, Term2, Bindings0, Bindings):
> + % unify_term(Term1, Term2, Bindings0, Bindings):
> %
> % Unify (with occur check) two terms with respect to a set of bindings
> % and possibly update the set of bindings.
> %
> -:- pred unify(term(T)::in, term(T)::in, substitution(T)::in,
> +:- pred unify_term(term(T)::in, term(T)::in, substitution(T)::in,
> substitution(T)::out) is semidet.
>
> % As above, but unify the corresponding elements of two lists of terms.
> % Fails if the lists are not of equal length.
> %
> -:- pred unify_list(list(term(T))::in, list(term(T))::in,
> +:- pred unify_term_list(list(term(T))::in, list(term(T))::in,
> substitution(T)::in, substitution(T)::out) is semidet.
>
> - % unify(Term1, Term2, BoundVars, !Bindings):
> + % unify_d_termont_bind(Term1, Term2, BoundVars, !Bindings):
s/unify_d_termont_bind/unify_term_dont_bind/
I only glanced at the changes to the compiler and other components but they
all seemed okay.
Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list