[Home] [Groups] - Message: [Prev in Group] [Next in Group]

nu.kanga.list.mud-dev

1568: Re: [MUD-Dev] Languages

[Full Header] [Plain Text]
From: clawrenc@cup.hp.com
Newsgroups: nu.kanga.list.mud-dev
Date: Tue, 20 May 97 13:12:44 -0700
References: [1]
Organization: Kanga.Nu
In <9705181712.80s1@ami-cg.GraySage.Edmonton.AB.CA>, on 05/18/97 
   at 10:22 AM, cg@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@null.net
(Contractor)                           Internet: coder@ibm.net
---------------(*)               Internet: clawrenc@cup.hp.com
...Honorary Member Clan McFUD -- Teamer's Avenging Monolith...