[m-dev.] for review: impure functions
Tyson Dowd
trd at cs.mu.OZ.AU
Thu Apr 6 00:58:00 AEST 2000
A diff of the changes to the top of purity.m:
--- purity.m 2000/04/05 08:23:42 1.1
+++ purity.m 2000/04/05 14:27:35
@@ -75,13 +75,29 @@
% semipure or impure predicates. This promise cannot be checked, so we must
% trust the programmer.
%
-% XXX The current implementation doesn't handle impure functions. The main
-% reason is that handling of nested functions is likely to get pretty
-% confusing. Because impure functions can't be reordered, the execution
-% order would have to be strictly innermost-first, left-to-right, and
-% predicate arguments would always have to be evaluated before the
-% predicate call. Implied modes are right out. All in all, they just
-% won't be as natural as one might think at first.
+% See the language reference manual for more information on syntax and
+% semantics.
+%
+% The current implementation now handles impure functions.
+% They are limited to being used as part of an explicit unification
+% with a purity indicator before the goal.
+% impure X = some_impure_func(....)
+% This eliminates any ordering problems with nested impure functions.
+% Of course it also eliminates the benefits of using functions to
+% cut down on the number of variables introduced. The main use of
+% impure functions is to interface nicely with foreign language
+% functions.
+%
+% Wishlist:
+% It would be nice to use impure functions in DCG goals as well as
+% normal unifications.
+%
+% We could give better error messages for impure calls inside
+% closures. It's possible to give the context of these calls,
+% although we should be careful to pinpoint these as the source of
+% the error (no impurity allowed in closures) rather than as
+% errors to be corrected.
+%
:- module purity.
--
Tyson Dowd #
# Surreal humour isn't everyone's cup of fur.
trd at cs.mu.oz.au #
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list