[m-rev.] for review: fix hash table bug
Simon Taylor
stayl at cs.mu.OZ.AU
Fri Mar 21 09:52:25 AEDT 2003
On 21-Mar-2003, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 20-Mar-2003, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> >
> > Estimated hours taken: 1
> > Branches: main, release
> >
> > NEWS:
> > library/hash_table.m:
> ...
> > Replace hash_table__search with a function, for consistency
> > with the rest of the interface.
>
> That part should not be committed on the release branch.
> We shouldn't be changing the library interface in a bug-fix release.
Fixed.
> In fact I usually prefer to use predicates rather than functions
> for semidet procedures. This procedure is semidet, unlike all the
> other procedures in the interface. So I think consistency with
> the rest of the interface is not a very good argument here.
> So personally I'd be inclined to skip this part on the main branch too.
> However, if you are very keen to make this change, I won't object.
Estimated hours taken: 0.1
Branches: main
NEWS:
library/hash_table.m:
Don't make the predicate version of hash_table__search
obsolete. Fergus and Ralph prefer to use predicates
instead of semidet functions.
Index: NEWS
===================================================================
RCS file: /home/mercury1/repository/mercury/NEWS,v
retrieving revision 1.306
diff -u -u -r1.306 NEWS
--- NEWS 20 Mar 2003 06:25:51 -0000 1.306
+++ NEWS 20 Mar 2003 22:49:10 -0000
@@ -90,8 +90,7 @@
`is_nan_or_inf/1' to float.m. These predicates are for use only on
systems which support IEEE floating point arithmetic.
-* `hash_table__search/3' has been made obsolete and replaced by a function,
- for consistency with the rest of the interface.
+* We've added a function version of `hash_table__search/3'.
* getopt.m now accepts a `maybe_string_special' option type.
Index: library/hash_table.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/hash_table.m,v
retrieving revision 1.6
diff -u -u -r1.6 hash_table.m
--- library/hash_table.m 20 Mar 2003 06:25:53 -0000 1.6
+++ library/hash_table.m 20 Mar 2003 22:13:08 -0000
@@ -166,6 +166,10 @@
:- mode search(hash_table_ui, in) = out is semidet.
%:- mode search(in, in, out) is semidet.
+:- pred search(hash_table(K, V), K, V).
+:- mode search(hash_table_ui, in, out) is semidet.
+%:- mode search(in, in, out) is semidet.
+
% Convert a hash table into an association list.
%
:- func to_assoc_list(hash_table(K, V)) = assoc_list(K, V).
@@ -180,19 +184,6 @@
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
-
-:- implementation.
-
-% Everything beyond here is not intended as part of the public interface,
-% and will not appear in the Mercury Library Reference Manual.
-
-:- interface.
-
-:- pred search(hash_table(K, V), K, V).
-:- mode search(hash_table_ui, in, out) is semidet.
-%:- mode search(in, in, out) is semidet.
-:- pragma obsolete(search/3).
-
:- implementation.
:- import_module math, bool, exception, list, require, std_util.
--------------------------------------------------------------------------
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