[MUD-Dev] Languages

clawrenc at cup.hp.com clawrenc at cup.hp.com
Tue May 20 13:12:44 New Zealand Standard Time 1997


In <9705181712.80s1 at ami-cg.GraySage.Edmonton.AB.CA>, on 05/18/97 
   at 10:22 AM, cg at ami-cg.graysage.edmonton.ab.ca (Chris Gray) said:

>[Chris L:]
>:A key part of C's use of braces is implicit in the base design of the
>:language (and obvious when looking at the BNF diagram).  In C, any place
>:that a statement can be used (in a non-expression context), a pair of
>:braces containing one or more statements can be used instead.	Its a
>:slightly subtle and very pleasing piece of orthogonality, and is why:

>[Example deleted]

>Yep, that's true. However, it is also the cause of some of the
>problems in C. It can be a pain to see something like this filling up
>some of your window:

>		}
>	    }
>	}
>    }
>}

Which is why a good friend of mine (and a damned fine programmer)
codes that as:

  if () {
    while () {
      if () {
        if () {
  } } } } 
        

>The compiler can recover a lot better, too, and often report errors
>more reliably/understandably. This is one of those language-religion
>things that everyone has their own view on. Food for endless debate!
>:-)

Yup.  I note your preference for od/esac/etc, but I prefer the braces
as they offer me one rule and one format which can be applied anywhere
vs a per-statement type special case.  As you say, it makes for horse
races.

--
J C Lawrence                           Internet: claw at null.net
(Contractor)                           Internet: coder at ibm.net
---------------(*)               Internet: clawrenc at cup.hp.com
...Honorary Member Clan McFUD -- Teamer's Avenging Monolith...




More information about the MUD-Dev mailing list