[Top][All Lists]

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

Re: for_UP_and_DOWN

From: Graham Percival
Subject: Re: for_UP_and_DOWN
Date: Sun, 15 Apr 2012 16:13:09 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Sun, Apr 15, 2012 at 04:49:11PM +0200, David Kastrup wrote:
> Łukasz Czerwiński <address@hidden> writes:
> > The final suggestion depends on suggestions from all of you. If you
> > find a better idea for (UP_and_DOWN(d)), I'll do so. If you find
> > easier: for_UP_and_DOWN, it could be this.
> I find for_UP_and_DOWN somewhat more consistent, but syntax-aware
> editors (and indenters) don't share my sentinent.  So using that will be
> rather boorish.

That's precisely why I liked the suggestion of
  for (UP_and_DOWN(d))
since editors will have no problem with that.

> The C++ way would be to use iterators here.  Something like
> use std;
> const vector <Direction> up_and_down { UP, DOWN };
> for (vector<Direction>::iterator d = up_and_down.cbegin ();
>      d != up_and_down.cend(); ++d) {
>     [Do something with *d]
> }

is that really the kind of un-abstraction you like to see?
I mean, sure, go ahead and use an iterator for the macro
definition.  But my eyes glaze over when I see a for loop spanning
multiple lines.  All we want to do is execute some code for UP and

> > I'd like to write code, that will make Lilypond better or easier to be
> > used
> Not necessarily the same as "the C++ way".

inb4 "those goals are mutually incompatible".  ;)

- Graham

reply via email to

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