[MUD-Dev] Languages

Chris Gray cg at ami-cg.GraySage.Edmonton.AB.CA
Sun May 18 10:12:18 New Zealand Standard Time 1997


[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:

		}
	    }
	}
    }
}

I find myself getting lost a lot less often if it is instead:

		fi;
	    od;
	od;
    fi;
corp;

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! :-)

:There are lots of other more interesting examples, such as creating very
:locally scoped automatics:

No reason you can't do that with the keyword stuff - they can introduce a
new scope as well. I can't resist adding that

    if a < b then
	f();
	g();
    fi;

has one less token in it than

    if (a < b) {
	f();
	g();
    }

:-)   (And three more characters, although they are not shifted.)

--
Chris Gray   cg at ami-cg.GraySage.Edmonton.AB.CA



More information about the MUD-Dev mailing list