[mercury-users] Pred defns

Peter Schachte pets at students.cs.mu.OZ.AU
Fri Apr 3 12:29:39 AEST 1998

On Thu, 2 Apr 1998, Ralph Becket wrote:

> I'm going to go out on a limb here and may get (justifiably) shot down
> in flames, but... why don't we bite the bullet and accept that bits of
> source code written in this style will not be syntactically identical
> with its FOL denotation?

I think you're right.  

This is the situation as I see it:

1.  Some groups of predicates have a lot of data to pass around.  This
    naturally leads to the too-many-arguments syndrome.

2.  This can be fixed by bundling disparate things together to make it
    convenient to pass them around.  Unfortunately, this often leads to a
    lot of packing and unpacking, which can make the code about as noisy as
    before the bundling.

3.  If you're not going to pass data as many arguments, and not going
    to bundle them, I can't see what else you can do but not pass them at
    all, at least not visibly.  This leads to the desire for inter-predicate
    argument threading.

> The point of the syntactic transformation is that you are just adding
> syntactic sugar - you aren't changing the language in any real sense.

No, you really are changing the language from the user's perspective.  This
is what people seem to object to.  A program written with either your
package or mine, or any of the others, won't look like one written without
it.  In particular, reordering conjunctions changes the meaning of the
program, rather than just whether or not it causes an error (Prolog), or not
changing the behavior of the program at all (Mercury).  But of course DCGs
are a precedent for this.

> The compiler still gets to play all its jolly rearrangement games.

Right.  Once the expansion is done, it's an ordinary Prolog/Mercury program
that can be optimized in all the usual ways.  Nothing impure about it.

-Peter Schachte               | IBM is not a necessary evil. IBM is not
mailto:pets at cs.mu.OZ.AU       | necessary.
http://www.cs.mu.oz.au/~pets/ |     -- Ted Nelson 
PGP key available on request  | 

More information about the users mailing list