lilypond-devel
[Top][All Lists]
Advanced

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

Re: Obviate method_finder methods (issue 551780043 by address@hidden)


From: dak
Subject: Re: Obviate method_finder methods (issue 551780043 by address@hidden)
Date: Sun, 19 Apr 2020 00:56:36 -0700

Reviewers: lemzwerg,

Message:
On 2020/04/19 05:53:34, lemzwerg wrote:
> Nice!  I don't really understand the C++ wizardry, but having to type
less
> macros in the normal code is certainly beneficial.

The wizardry is comparatively confined and mainly consists of a more
polished version of the mfp_baseclass thing that I needed to address
Dan's complaints about issue 5916 (which will need to get rebased on
this more elaborate version).  The advantage, of course, is that the
whole problem underlying issue 5600 that kept Clang from working (and
likely would have stopped GCC at some point of time) before Jonas found
a solution: gone.

The fundamental problem is that something like
&Global_context::create_context_from_event (a member function pointer to
an inherited function) is not of type void (Global_context::*)(SCM) but
of type void (Context::*)(SCM), and in the context of template argument
matching, you need to match the type exactly.

The basic C++ wizardry used here would already have worked in C++98 but
would have required a number of more specialised versions of
mfp_baseclass (for lack of template parameter packs).  I just failed to
come up with it before Dan asked for wart removal in issue 5916.

The disadvantage, of course is "I don't really understand the C++
wizardry".  C++11 has appropriated Perl's capacity of reading like line
noise, but in contrast to Perl, you never really get to the stage where
this line noise stops causing headaches.

At least this one saves a lot of other headaches.  And mfp_baseclass
does a well-defined job in a manner and with an interface typical to
C++11.  And it's few lines of headache in a single place rather than
something spread over all of the source code.

Description:
Obviate method_finder methods

The inheritance of various Translator::method_finder functions was a
comparatively fragile mess.  A helper class mfp_baseclass is able to
figure out the proper baseclass for a given member function pointer.
That allows removing the method_finder functions from the various
Translator-derived classes.

Please review this at https://codereview.appspot.com/551780043/

Affected files (+52, -61 lines):
  M lily/auto-beam-engraver.cc
  M lily/beam-engraver.cc
  M lily/context.cc
  M lily/include/callback.hh
  M lily/include/coherent-ligature-engraver.hh
  M lily/include/engraver.hh
  M lily/include/gregorian-ligature-engraver.hh
  M lily/include/ligature-engraver.hh
  M lily/include/translator.hh
  M lily/include/translator.icc
  M lily/kievan-ligature-engraver.cc
  M lily/mensural-ligature-engraver.cc
  M lily/phrasing-slur-engraver.cc
  M lily/repeat-tie-engraver.cc
  M lily/score-engraver.cc
  M lily/score-performer.cc
  M lily/translator-group.cc
  M lily/vaticana-ligature-engraver.cc





reply via email to

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