[mercury-users] Mercury and imperative programming

Don Smith dsmith at cs.waikato.ac.nz
Thu Apr 29 08:09:16 AEST 1999


Hello,

Mercury already allows side-effecting I/O at the uniquely-moded, deterministic
top-level of control.  And it also allows destructive update, both at the 
uniquely moded top-level and in mostly uniquely-moded nondeterministic code.

Why not, then, support full-blown imperative-style programming, with familiar
imperative syntax (e.g.,  x:= x+1, array[i]:= x, WHILE loops, and FOR statements)
in these contexts?  This would greatly increase the marketability of Mercury.

I think declarative programmers need to get away from the puritanical idea
that assignment and side effects are somehow impure and dirty.  These
features have their legitimate uses and their own respectable semantics (e.g., 
bisimulation and predicate transformers).    In any case, Mercury already allows
side effects. I'm mostly suggesting you make the syntax more familiar.  It would be 
really neat if Mercury allowed both imperative and declarative code, while at the 
same cleanly separating the two worlds.

Another advantage would be that one could then use Mercury as a nondeterministic
imperative langyage (like C with backtracking).   Compare: Siskind's Screamer
(nondeterministic Scheme).

Thinking aloud ....

   Don (dsmith at cs.waikato.ac.nz)
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list