lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PATCH: Refactor script-column.cc for improved reading and fewerlines


From: David Kastrup
Subject: Re: PATCH: Refactor script-column.cc for improved reading and fewerlines
Date: Fri, 04 Dec 2009 19:05:44 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

"Trevor Daniels" <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]