🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #560

Re: Prefix operators and blanks (was: WG17)

#560
From: Micha Meier
Date: Fri, 08 Dec 1989 11:36
41 lines
2573 bytes
In article <24703@cup.portal.com> pgl@cup.portal.com (Peter G Ludemann) writes:
>If one decides to define 'not' as a prefix operator and also
>chooses to use it with as a functor (e.g. `not(a,b)'), one is
>asking for trouble and should instead disambiguate by extra
>quote marks or parentheses: 'not'(a,b) or not((a,b)).
>
>I therefore suggest that the Prolog standard specifically
>disallow using a prefix operator as a functor.  The use of
>quotes and extra parentheses allows clear disambiguation.

The use of quotes to hide the operator precedence is one of the weakest
points introduced by BSI. The quotes are used both to make an atom
and to disable the operators, although parentheses are clearly
the right way to this. The use of these two must not be deliberate,
quotes should be used only to make an atom out of a sequence of characters
that would normally not be recognized as an atom, and parentheses are used
to denote a term, hence also the token 'ATOM'.

If one decides to forbid prefix operators as functors, then
clearly not(a, b), (not)(a, b) and 'not'(a, b) are wrong, and so
only not((a, b)) should be possible.

However, forbidding prefix operators as functors does not seem to
me as the best choice, I would say that forbidding, say, not(p(a))
is worse than making not(a, b) and not (a, b) different.
It is true that the former is only boring because you have
to edit all the places which are wrong, but the parser
will report all of them, whereas with the latter
the user may end up by calling a wrong procedure and then he has to use
the debugger to find it (unless the procedure is undefined).
Still, it is a good programming style to use the parentheses
when using terms with main functor ',' no matter if the
predicate is an operator or not and so I think all the good guys
should not be forced to use parentheses just because of
some bad guys that use bad style and ask for troubles anyway :-)

This is what we implemented in Sepia, spaces are not significant
except between a prefix operator and the opening parnthesis, and so far
we got no complaints because of this.

--Micha Meier
Technical Details
Message-ID: <799@ecrcvax.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!unido!ecrcvax!micha
References: <24703@cup.portal.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!unido!ecrcvax!micha
From: micha@ecrcvax.UUCP (Micha Meier)
Newsgroups: comp.lang.prolog
Subject: Re: Prefix operators and blanks (was: WG17)
Message-ID: <799@ecrcvax.UUCP>
Date: 8 Dec 89 11:36:03 GMT
References: <24703@cup.portal.com>
Reply-To: micha@ecrcvax.UUCP (Micha Meier)
Organization: ECRC, Munich 81, West Germany
Lines: 41