lilypond-devel
[Top][All Lists]
Advanced

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

Re: Redesign listeners using templates (issue 235790043 by address@hidde


From: dak
Subject: Re: Redesign listeners using templates (issue 235790043 by address@hidden)
Date: Fri, 01 May 2015 07:14:14 +0000

On 2015/05/01 01:22:57, Dan Eble wrote:
On 2015/05/01 00:44:45, dak wrote:
> I am not going to put in an explanation for every definition of
equal_p for
some
> smob class.

OK, that makes sense now.

> > invoked as T* t = ly_unsmob<T>(target);
>
> I don't think that warrants a template function of its own.  It just
makes
> matters murkier without saving a significant amount of typing.

Then we'll differ. Repeating the type three times on a line is twice
more than I
like. (With C++11 it could be auto t = ly_unsmob<T>(target).)

But deferring to your judgment, what is your opinion of

    static Engraver *unsmob (SCM eng) {
        return dynamic_cast<Engraver *> (Translator::unsmob (eng));
    }

and eight similar cases I can find which go about saving a small
amount of
typing independently?

I am not particularly enamored.  The expectation would be that this goes
with an is_smob, and the expectation of an is_smob is that it goes with
a Scheme predicate, and a Scheme predicate should go with a printable
type (and that's a somewhat high granularity and I don't even know how
to come up with a good naming scheme for what amounts to type names and
descriptions for _every_ _single_ C++ engraver or performer).  That's
quite more than 8.

Now if all that were done, the passage in question here would look
nicer, and its error message would likely be more on-spot.  But it seems
like a somewhat tricky endeavor.  I doubt it is worth the trouble.

https://codereview.appspot.com/235790043/



reply via email to

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