determinism question

Don Smith dsmith at cs.waikato.ac.nz
Tue Nov 3 20:30:08 AEDT 1998


>If it did that, then the determinism-correctness of p/1 would depend
>not only on the declarations of p0, p1, p2, and p3, but also on their
>definitions.  This would be a violation of abstraction -- the
>declarations (and documentation) should specify the interface, and
>callers should depend for their correctness only on the documented
>interface, not on the implementation details.

I could agree with your attitude when it comes to respecting the
abstraction of a module by not depending on any particular details of
the implementation of its declared interface.  But within a module, all
sorts of inter-procedural optimizations seem like fair game to me.

After all, one of the major advantages of declarative programming is
supposed to be that we can do all sorts of meaning-preserving
transformations based on semantic equivalence.  The type, mode, and
determinism declarations of a Mercury procedure are not complete
specifications of the procedure's semantics.  I rather tend to regard
the code itself as an (executable) logical specification.  I thought
that's the main idea of logic programming!

  Don



More information about the users mailing list