On Sun, Apr 01, 2012 at 06:12:27AM +0000,
address@hidden wrote:
> On 2012/04/01 05:00:25, Graham Percival wrote:
> >it would be much nicer if there was a macro for this.
>
> It is better to define macros for just the part inside the for(...) .
> Then we can write, and auto-indenters can indent,
>
> for (UP_and_DOWN(d))
> { ... }
> for (LEFT_and_RIGHT(d))
> { ... }
ooh, I like that! I really, really like it!
> However, is a macro nicer ?
Yes, absolutely.
> The first time every new contributor sees this loop form, she has to
> take the time to understand it. The macro adds two steps to initial
> understanding: realizing that this must be a macro, and then searching
> for the macro definition.
I disagree. If there's a macro like that, used everywhere in the
code base, then as a new contributor I'd be happy assuming that it
does what it claims. If UP_and_DOWN(d) was broken, then surely
there'd be tons of breakage all over the code. I consider this a
useful abstraction.
Now, there should probably be a paragraph explaining those two
macros in the CG. But that's a minor detail.
- Graham