[mercury-users] Pred defns
Fergus Henderson
fjh at cs.mu.OZ.AU
Tue Mar 31 01:49:25 AEST 1998
On 30-Mar-1998, Ralph Becket <rwab1 at cam.sri.com> wrote:
> Just a word in my defence: while Fergus' syntax uses atoms to denote
> accumulators and #x to refer to the current value of acc. x, my
> expansion does indeed provide the same functionality:
Yes, indeed. And thank you for your proposal, I do think it is quite nice.
I'm just trying to make it a bit more "O'Keefe-proof" ;-)
> Personally I'd prefer keeping capitalised names for accumulators -
> since this is a syntactic expansion before compilation it doesn't
> really matter what you pick.
If you want to always think about things at the lower level
(i.e. about the structure *after* preprocessing), then it doesn't
really matter. But I'd like to be able to reason about the code
at the higher level rather than at the lower level.
And I might even want to write tools which manipulate the code
at the higher level. For either of these purposes, the syntax
chosen *is* important.
I think Richard O'Keefe is right to object to the use of the same
notation (capital letters) for two quite difference concepts
(accumulators and logic variables).
> And #s are #ugly#!
#s do stand out, but that could be considered an advantage rather
than a disadvantage.
> Fergus Henderson wrote on 30 Mar:
> >
> > With this proposal, `,' doesn't necessarily mean conjunction anymore,
> > but if a sub-goal (A,B) has no `##'s or `###'s, then the `,' is
> > indeed conjunction. I suppose that in practice the `##'s or `###'s in
> > the body would be enough of a red flag that using `#{...}' or `#:-'
> > would not really be needed.
>
> Same problem with DCG expansion, so at least there's precedent.
Ah, but with DCG expansion, you have `-->' as a red flag.
So the precedent is not quite the same.
DCG expansion has the nice property that its semantics can be
completely described by meta-interpretation (i.e. at the high level)
rather than by transformation to lower-level code.
This is true of the proposal above only at the expense of
applying the meta-interpreter based semantics to all code.
> A suggestion: why not decide upon a notation (if this proposal has
> support) and provide a preprocessor.
By the way, if anyone wants to have a go at this, the file
`samples/expand_term.m' is a good place to start.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
More information about the users
mailing list