"Trevor Daniels" <t.dani...@treda.co.uk> writes:

> David Kastrup wrote Friday, December 04, 2009 4:24 PM
>>
>> I've unwrapped a bit of code of the form
>>
>> for (a;b;c) {
>>  if (condition)
>>    short something
>>  else {
>>    Large something
>>  }
>>  z
>> }
>>
>> into
>>
>> for (a;b;z,c) {
>>  if (condition) {
>>    short something
>>    continue;
>>  }
>>  Large something
>> }
>>
>> which helps a bit keeping track of what happens where.
>
> I disagree.  Hiding the z in the iteration clause means
> it is likely to be overlooked.

If the z is a natural part of the iteration, unlikely.  Then you will
rather be happy to see that no branch has forgotten dealing with it.

> Also the use of continue rather than else does not clarify the
> structure IMO.

It helps in that you don't need to look what happens after
short_something.  And it means that the rest of the code is just
happening for Large something.

It may not "clarify the structure", but lets you read it linearly
without having to keep the meaning of a dozen nesting levels in mind.

Anyway, academical right now: the reordering has just shown to myself
that I don't understand what happens even if I have everything laid out
as clear as I can for _my_ taste.

So I am waiting for input before coming up with a proposal, and then it
will be worth discussing prettiness or not.

But now there is no code to talk about anyway.

-- 
David Kastrup


_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to