[mercury-users] random quantification suggestion
Fergus Henderson
fjh at cs.mu.OZ.AU
Tue Jun 4 16:17:52 AEST 2002
On 03-Jun-2002, Michael Day <mikeday at bigpond.net.au> wrote:
>
> Just a piece of random syntax sugar for quantification; replace this:
>
> :- some [T] pred foo(T).
>
> with this:
>
> :- pred foo(T) for some [T].
...
> It would require an operator "for" with the appropriate precedence and so
> forth; I don't really have any idea if it's feasible.
It would not be very feasible, because `some' is a binary prefix operator,
whereas in the code above it is being used as a unary prefix operator.
But even if it was feasible, I don't think it would be a very good idea.
Firstly, quantification is a scoping construct, and I think these generally
work better as prefixes rather than suffixes.
Secondly, for consistency the syntax for type quantification should be the
same as the syntax for variable quantification in goals.
Thirdly, we'd need to continue to support the existing syntax
(for backwards compatibility, if nothing else), and I don't think
allowing both variants would improve readability.
> :- pred foo(T) for some [T] => store(T).
Ugh. Here you have the scoping construct not at the start or at the end,
but in the middle, which is horrible, IMHO.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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