lilypond-devel
[Top][All Lists]
Advanced

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

Re: Beautify Grob_array and stop using std::vector::data() (issue 264950


From: dak
Subject: Re: Beautify Grob_array and stop using std::vector::data() (issue 264950043 by address@hidden)
Date: Sun, 06 Sep 2015 07:25:12 +0000

On 2015/09/06 01:50:43, Keith wrote:
On Sat, 05 Sep 2015 17:49:44 -0700,
<mailto:address@hidden> wrote:

> I have simply removed the comments warning about filtering
> ordered arrays.

That seems to be correct.  Those comments were incorrect.
The filter_map* functions do not, in fact, change the order of the
array under
the meaning of 'ordered_'.  Pál's comment makes sense.

There is no sorting method in Grob_array so there is no reason to
suspect that
the member 'ordered_' has anything to do with order under a sorting
criterion.
Looking at the commits that touch 'ordered_' it is clear that its
meaning was
"this array should stay in its current order" and that removal of
elements
doesn't count as a change in order and substituting Grobs inherit the
order the
Grobs they replace.

Thanks for figuring this out, and sorry to Dan for the false alarm.  I
wish our codebase were less writeonly so that one could readily guess
this from the comments in the respective header files.

grob-array.hh and grob-array.cc combined contain a single comment apart
from the copyright header, namely

#if 0  /* see System::derived_mark () const */

which is cryptic in itself.  It also contains

void
Grob_array::remove_duplicates ()
{
  assert (!ordered_);

  uniquify (grobs_);
}

which I am less that sure even makes sense any more: since issue 3365,
the variant of uniquify employed here preserves order anyway.  I
probably was not really capable of figuring out with reasonable effort
what this assert was supposed to protect against and rather left it in.

It takes far too much reverse engineering to work on LilyPond.

https://codereview.appspot.com/264950043/

reply via email to

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