lilypond-devel
[Top][All Lists]
Advanced

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

Re: Issue 5362: Generalize context searches (issue 344050043 by address@


From: David Kastrup
Subject: Re: Issue 5362: Generalize context searches (issue 344050043 by address@hidden)
Date: Sun, 01 Jul 2018 22:43:52 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Dan Eble <address@hidden> writes:

> On Jul 1, 2018, at 15:08, address@hidden wrote:
>> 
>> We currently have
>> 
>> address@hidden:/usr/local/tmp/lilypond$ git grep "find or create" lily
>> lily/context.cc:      warning (_f ("cannot find or create new `%s'",
>> lily/context.cc:  warning (_f ("cannot find or create `%s' called `%s'",
>> address@hidden:/usr/local/tmp/lilypond$
>> 
>> That's not multiple callers.  It's two different messages for two
>> different situations.  Why would a sensible refactoring introduce more
>> callers?
>> 
>
> The current code has the messages built into the search methods, so
> there are only two.  My patch pulls them out, letting the callers
> decide whether to warn, and there are six callers that choose to warn.
>
> change-iterator.cc:        Context::warning_cannot_find (origin, to_type, 
> to_id);
> context-specced-music-iterator.cc: Context::warning_cannot_create
> (origin, ct, c_id);
> context-specced-music-iterator.cc:
> Context::warning_cannot_find_or_create (origin, ct, c_id);
> context.cc: Context::warning_cannot_find_or_create (/*source
> location*/ 0, name, id);
> quote-iterator.cc: Context::warning_cannot_find_or_create (origin,
> name, c_id);
> simultaneous-music-iterator.cc: Context::warning_cannot_find_or_create
> (get_music ()->origin (),
>
> It might make sense for the one in context.cc to be pulled out into
> its callers as well, but I was not planning to investigate that now.

So what benefit do we get from forking out two different warnings for
two different situations into one warning for six situations?  What does
your code do better after the refactoring making this desirable?

-- 
David Kastrup



reply via email to

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