[m-rev.] for review: module qualification of equality preds
Simon Taylor
stayl at cs.mu.OZ.AU
Mon May 19 14:13:13 AEST 2003
On 19-May-2003, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> Simon Taylor, Monday, 19 May 2003:
> >
> > Estimated hours taken: 4
> > Branches: main, release
> >
> > The compiler was not module qualifying the `where equality is ...'
> > part of type declarations in interface files. This could cause the
> > compiler to use the wrong predicate in importing modules if the
> > user-defined equality predicate was not exported.
> >
> > To avoid this problem we now require user-defined equality or
> > comparison predicates for a type to be defined in the same module
> > as the type. This is the only simple way to module qualify the
> > unification predicates in interface files without running
> > typechecking.
>
> This restriction should be documented for users.
Estimated hours taken: 4
Branches: main, release
The compiler was not module qualifying the `where equality is ...'
part of type declarations in interface files. This could cause the
compiler to use the wrong predicate in importing modules if the
user-defined equality predicate was not exported.
To avoid this problem we now require user-defined equality or
comparison predicates for a type to be defined in the same module
as the type. This is the only simple way to module qualify the
unification predicates in interface files without running
typechecking.
compiler/prog_io.m:
compiler/prog_io_pragma.m:
Require user-defined equality or comparison predicates for a
type to be defined in the same module as the type.
NEWS:
doc/reference_manual.texi:
Document the change.
compiler/typecheck.m:
compiler/post_typecheck.m:
compiler/hlds_pred.m:
compiler/make_hlds.m:
compiler/*.m:
Calls in the compiler generated unification predicates are
now guaranteed to be fully qualified, so don't attempt
to search for more qualified predicates.
Add a new pred_marker 'calls_are_fully_qualifed' to
identify predicates whose bodies contain only fully
qualified calls, rather than testing the import_status.
tests/invalid/Mmakefile:
tests/invalid/exported_unify.m:
tests/invalid/exported_unify2.m:
tests/invalid/exported_unify2.err_exp:
Test case.
Index: NEWS
===================================================================
RCS file: /home/mercury1/repository/mercury/NEWS,v
retrieving revision 1.311
diff -u -u -r1.311 NEWS
--- NEWS 7 May 2003 06:42:31 -0000 1.311
+++ NEWS 19 May 2003 03:30:13 -0000
@@ -10,7 +10,9 @@
declarations and in the head of a clause for a user-defined field access
function.
* We now support impure higher-order code.
-* We now allow user-defined comparison routines.
+* We now allow user-defined comparison predicates.
+* User-defined equality and comparison predicates for a type are now
+ required to be defined in the same module as the type.
Changes to the Mercury compiler:
* Better support for incremental program development:
@@ -42,11 +44,14 @@
Changes to the Mercury language:
-* We now allow user-defined comparison routines, using the syntax
+* We now allow user-defined comparison predicates, using the syntax
:- type t ---> t where equality is unify_t, comparison is compare_t.
See the "User-defined equality and comparison" chapter of the
Mercury Language Reference Manual for details.
+
+* User-defined equality and comparison predicates for a type are now
+ required to be defined in the same module as the type.
* Infix `.' is now accepted as a module name separator. Hence it is
now possible to write io.write_string and list.member to mean the
--------------------------------------------------------------------------
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