Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!sunic!sics.se!sics.se!matsc From: matsc@sics.se (Mats Carlsson) Newsgroups: comp.lang.prolog Subject: Re: Prefix operators and blanks (was: WG17) Message-ID: Date: 6 Dec 89 08:50:53 GMT References: <24703@cup.portal.com> Sender: news@sics.se Organization: Swedish Institute of Computer Science, Kista Lines: 44 In-Reply-To: pgl@cup.portal.com's message of 4 Dec 89 03:05:49 GMT 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. But what about prefix operators that are atoms that need quoting? Disallowing them altogether seems a rather severe restriction. If they are allowed, quotes cannot be used for the disambiguating rule in the first paragraph. Are you suggesting that an extra pair of parentheses would be required in that case? Peter's suggestion would have an impact on the canonical syntax of Prolog. I don't have the WG17 draft handy, but I can't imagine that it fails to define a canonical syntax which is independent of any operator declarations that happen to be declared, so that a printed term can always be read back in. Many Prologs provide write_canonical/[1-2] as built-in predicates exactly for this purpose. With Peter's suggestion ALL functors would have to be printed with quotes in the canonical syntax, e.g. 'f'(1,2). to cater for the case that it might be read in with 'f' declared as a prefix operator. The idea of letting quotes influence how terms are parsed seems to blur the distinction between lexical and syntactical analysis. It seems cleaner to treat quotes strictly at the lexical level. The only other language where "atoms" can be quoted that I know of is LISP, but LISP does not have user defined operators, so it's hard to find an analogy to justify Peter's suggestion. Another way of avoiding the ambiguity with `not(a,b)', `not (a,b)', ... (assuming spaces before the `(' are no longer significant) would be to simply disallow the use of `,' as an infix operator. -- Mats Carlsson SICS, PO Box 1263, S-164 28 KISTA, Sweden Internet: matsc@sics.se Tel: +46 8 7521543 Ttx: 812 61 54 SICS S Fax: +46 8 7517230