Path: utzoo!attcan!uunet!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!sics.se!sics.se!alf From: alf@sics.se (Thomas Sj|land) Newsgroups: comp.lang.prolog Subject: Re: Prolog parser bug in reading conditional? Or not? Message-ID: <1991Mar1.102711.7580@sics.se> Date: 1 Mar 91 10:27:11 GMT References: <1991Feb22.172635.16587@and.cs.liv.ac.uk> <4826@goanna.cs.rmit.oz.au> Sender: news@sics.se Organization: Swedish Institute of Computer Science, Kista Lines: 43 In-Reply-To: ok@goanna.cs.rmit.oz.au's message of 26 Feb 91 05:16:47 GMT in his article ok@goanna.cs.rmit.oz.au commenting on the questions of dave8@and.cs.liv.ac.uk: >Parentheses in Prolog have *NO* semantic effect, >they are *solely* a device for controlling grouping. It follows that > ( P -> Q ) ; R >*MUST* be the data structure > ;( ->( P, Q ), R ) >and it is this data structure which bears the meaning "if then else", >*not* the surface syntax. This last point shows a design decision in earlier Prologs which now and then causes problems. ok ends with some words of wisdom: >The rule of thumb is to never use P->Q on its own. This is doubly >advisable because there are otherwise excellent Prolog systems >which interpret a bare P->Q as P->Q;true. > >> Is this a parser problem or not? > >No, it is a parser WORKING. Just because it is "WORKING" doesn't mean the design is not unnecessarily confusing. The design decision to use A->B;C for if-then-else wasn't very clever in my opinion. I hope the standard will not be backwards compatible on this point. Even 'A->B|C' would be much better, if '|' was not immediately translated into ';'. Maybe we could use some other operator when we are not talking about disjunctions. ---Read Richard's book, someone might quote it, and you better be informed. -- Thomas Sjoeland SICS, PO Box 1263, S-164 28 KISTA, SWEDEN Tel: +46 8 752 15 42 Fax: +46 8 751 72 30 Internet: alf@sics.se ......