From: Bram Moolenaar <B...@Moolenaar.net>
Date: Sat, 31 Oct 2009 14:32:44 +0100
Local: Sat, Oct 31 2009 9:32 am
Subject: Re: Zimbu goals - comprehension
Igor V. Burago wrote: Thanks, that is a good idea. To see it in context: > I have two little suggestions about "one line IF" and loop labels. > First, possible replacement for obscure WHILE TRUE I would restrict this to using a statement that is a keyword. Trying to WHEN c == File.eof && fooOk blah = this & that Adding a ";" in there won't help much. > By the way, in my opinion BREAK_IF is not an elegant solution. At the moment, considering the remarks, I would rather stick with with a > And it's not a general one. normal IF. It's three lines, but avoids that the programmer has to make a choice. And the choice is not always obvious. Being a bit verbose is not that much of a problem: WHILE TRUE > Second, I think that I agree that having WHILE at the start of the line makes a larger piece > label:WHILE cond > stats > } > is not good at the point that '}' is no longer exactly under the > loop keyword ('WHILE' in this example). So while 'WHILE.label' is > a little difficult to read smoothly I personally would prefer this > over 'label:WHILE'. of code easier to read. > Let me suggest another variant of loop labels. Putting the label after the condition will make it difficult to find > WHILE cond : label > stats > WHEN notOk BREAK label > } > After that, of course, it's possible to ask > IF label.breakUsed > as it was suggested earlier. > And I think that no delimiters is needed between BREAK and label. > + '}' is always right under loop keyword > + label is not between keyword and condition (that makes loop header > less readable) when using a long condition: WHILE sadfasdf == asdfasdf.asdf.asdf() Besides, there is a grammer conflict with the ternary operator "cond ? Anyway, I think the label should be close to the WHILE. I have been using the ".something" notation in other places: FUNC.abstract RetType funcy(ArgType arg) I'm not sure if, for consistency, the same syntax should be used for the Using a slash: WHILE/loop asdfsdf == asdf.asdf.asdf() Using a dot: WHILE.loop asdfsdf == asdf.asdf.asdf() I tend to prefer WHILE/loop. -- /// Bram Moolenaar -- B...@Moolenaar.net -- http://www.Moolenaar.net \\\ You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||