Path: utzoo!attcan!uunet!lll-winken!lll-tis!mordor!sri-spam!sri-unix!quintus!ok From: ok@quintus.UUCP (Richard A. O'Keefe) Newsgroups: comp.lang.prolog Subject: Re: Clause fusion (Disjunctions) Message-ID: <1001@cresswell.quintus.UUCP> Date: 20 May 88 04:37:24 GMT References: <983@cresswell.quintus.UUCP> <5501@megaron.arizona.edu> <539@ecrcvax.UUCP> Organization: Quintus Computer Systems, Mountain View, CA Lines: 55 In article <539@ecrcvax.UUCP>, micha@ecrcvax.UUCP (Micha Meier) writes: > Richard proposes that nested if-then-else's are treated at the same level, > which leads to confusions since then the indentation is context dependent > (an if-then-else inside another one cannot be indented independently). I DO NOT! I use exactly the same rule for indenting if->then;elses in Prolog that I use in Fortran 77, Pop, ADA, Algol 68, et cetera. Namely [1 indent] [1 indent] ... [1 indent] Fortran 77 Pop Algol 68 Algol 68 Prolog IF (...) THEN if ... then if ... then ( ... | ( ... -> ELSE IF (...) THEN elseif ... then elif ... then |: ... | ; ... -> ELSE else else |: ; END IF close fi ) ) This style is officially recommended for ADA. I think of and perceive ( test1 -> body1 ; test2 -> body2 ; /*otherwise*/ body3 ) as if-then-else structure, not two. There is no nesting here (unless one of test1, body1, test2, body2, body3 contains an if-then-else). Ok, there are nested terms, but do you also regard (a,b,c) as nested conjunctions? It could be indented as two structures, but why go out of your way to spread the code across the page? Note that this approach puts the semicolons at the beginning of the lines, where it is difficult to mistake them for commas. > Isn't this problem a topic for the standardization committee? Not the committee we've got. To be perfectly frank, I'll defend my style with teeth and nails, if necessary, but there are enough competent Prolog people out there with styles different from mine (such as Saumya Debray) who use a very different style that I would not like to see my layout rules become part of a standard. It isn't hard to write an 'indent' utility for Prolog, so while I find Debray's layout, um, unfamiliar, that doesn't stop me reading his code _as if_ he had used my style. What we need from the committee is a sufficiently clear and concise definition of a large enough language with enough attention to portability concerns that I could develop a public-domain version of a Prolog indenter in Prolog on a Sun and expect it to work on a Mac and a 370 with very little change. I do not believe that we shall get this.