Basic coding style

spir denis.spir at gmail.com
Tue Nov 23 13:18:34 PST 2010


On Tue, 23 Nov 2010 10:00:07 -0500
Kagamin <spam at here.lot> wrote:

> Max Samukha Wrote:
> 
> > On 11/23/2010 01:17 PM, Kagamin wrote:
> > > void func(string[] strings) {
> > >>       string[] result;
> > >>       foreach (auto s ; strings) {
> > >>           if (s != "") {
> > >>               writefln("found: %s", s);
> > >>               result ~= s; }}}
> > 
> > This takes too much vertical space and should be rewritten to:
> > 
> > void func(string[] strings) {string[] result; foreach(auto s; strings){ 
> > if (s != "") { writefln("found: %s", s); result ~= s; }}}

Seriously, I fail to see how braces one their own line help visually catching code structure (and it's not only me ;-)

> I wanted to say D allows even python-style formatting. Brace matching editor will help in syntactical differences.

That's similar what some Lisp/Scheme do ;-) Just add end/closing parens until your editor is happy (highlighting the first opening one).

Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com



More information about the Digitalmars-d mailing list