How do you think about the flooding of bracket?
Deewiant
deewiant.doesnotlike.spam at gmail.com
Thu Jun 15 06:35:15 PDT 2006
BLS wrote:
> a simple example from Modula 2:
>
> Module Primes;
> FROM InOut IMPORT Writeln, ......;
>
> PROCEDURE abc
> ...
> PROCEDURE xyz
> ....
> END xyz
> ....
> END abc
> END Primes
>
> Have a look at then END declarations: I found them quit usefull and the code
> more readable, at least in deep nested functions.
>
I find something like that gets very annoying quickly, when "PROCEDURE xyz" is
one or two lines long. Imagine something like (mixed-syntax pseudocode):
PROCEDURE foo(int x)
PROCEDURE bar
PROCEDURE baz
return 6;
END baz
x += baz();
END bar
if (x) BEGIN
while (x < 10) BEGIN
bar();
foo(x);
END
END
return x;
END foo
At least to me, the extraneous foo/bar/baz in the above make it harder to
quickly read and understand.
In my mind, when things start to get unreadable due to them spanning many lines
and/or there being a lot of nesting, you can just use a comment at the ending
curly bracket:
void foo() {
...
} // end foo()
More information about the Digitalmars-d
mailing list