Related articles |
---|
[ANN] Squirrel yet another scripting language albertodemichelis@hotmail.com (2003-09-09) |
Re: [ANN] Squirrel yet another scripting language visionary25@hotmail.com (Vis Mike) (2003-09-14) |
Re: [ANN] Squirrel yet another scripting language me@here.there.com (Peter Ashford) (2003-09-22) |
Re: [ANN] Squirrel yet another scripting language emonk@slingshot.co.nz (Corey Murtagh) (2003-09-22) |
Re: [ANN] Squirrel yet another scripting language nmm1@cus.cam.ac.uk (2003-09-23) |
Re: [ANN] Squirrel yet another scripting language joachim.durchholz@web.de (Joachim Durchholz) (2003-09-23) |
Re: [ANN] Squirrel yet another scripting language vbdis@aol.com (2003-09-27) |
Re: [ANN] Squirrel yet another scripting language visionary25@hotmail.com (Vis Mike) (2003-09-27) |
From: | Joachim Durchholz <joachim.durchholz@web.de> |
Newsgroups: | comp.compilers,comp.games.development.programming.misc |
Date: | 23 Sep 2003 13:29:11 -0400 |
Organization: | Oberberg Online Infosysteme |
References: | 03-09-048 03-09-053 03-09-067 |
Keywords: | C, design, optimize |
Posted-Date: | 23 Sep 2003 13:29:11 EDT |
Corey Murtagh wrote:
> C-style for statements are very easy to parse,
Agreed.
> if the language is at all C-like, and very powerful. Although they
> /can/ be cryptic, they are also more versatile than simple indexed
> for statments.
There are alternatives that are more powerful and less cryptic.
If you wish to be C-style, use something like
// Loop set-up
loop {
// Repeated statements
// Incrementing indexes usually goes here
// If the loop is complicated enough that the loop invariant
// is interesting, it should go immediately before the "until"
// phrase, in the form of an assert() statement.
} until (expression) {
// repeated statements
// "actual worker code" usually goes here
}
The nice thing about this set-up is that all the administratrivia go
right at the start of the loop and are usually short, so the reader can
either inspect the administratrivia, or immediately skip to the actual
loop body.
The above construction shares these properties with the C loop, but
without the danger of accidentally confusing increment and loop
termination (one of my favorite errors when I learned C).
Note that there are useful styles beyond C. Actually I dont favor C, on
my keyboard, } is just as many keypresses as "end"...
Regards,
Jo
Return to the
comp.compilers page.
Search the
comp.compilers archives again.