[Top][All Lists]

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

Re: Problem compiling:

From: Urs Liska
Subject: Re: Problem compiling:
Date: Wed, 14 Nov 2018 11:01:23 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

Am 14.11.18 um 10:53 schrieb Thomas Morley:
Am Mi., 14. Nov. 2018 um 10:28 Uhr schrieb David Kastrup <address@hidden>:
David Kastrup <address@hidden> writes:

Davide Liessi <address@hidden> writes:

Il giorno mer 14 nov 2018 alle ore 08:25 Keizen Li Qian
<address@hidden> ha scritto:
In procedure ly:music-transpose in expression (ly:music-transpose
(make-music # # ...) tonic):
/usr/share/lilypond/2.18.2/ly/ Wrong
type (expecting pair): major
You probably wrote
\key c major
instead of
\key c \major
Well spotted.  The embarrassing thing is that we even get there: this
is something that should rather be caught earlier.  We have

key =
#(define-music-function (tonic pitch-alist)
    ((ly:pitch? '()) (list? '()))

and the word major qualifies as list? by getting converted to '(major)
which is a symbol list like needed for some override/tweak

So it very much looks like we should use a more specific predicate than
list? for the scale type in order to not have that user error pass down
in this manner.

Well, I can bump that rather easily (using existing predicates) to error: wrong type for argument 2.  Expecting list of number pairs, found 
   \key c

This is probably at best slightly less obscure to the beginner but at
least flags the right place and element in the input.  To give a nicer
message, one would need a specific predicate for scales.

David Kastrup

lilypond-user mailing list
I'm not convinced about below, but for the record:

One could give the key-function a string-argument, or probably a symbol
And react on the input, like

(case <input>
   (("major") major)
   (else (ly:error/warning "message"))

Obviously pseudo-code (I'm in a hurry), but I hope the proposal is made clear.
Also, would need a convert-rule.

I don't think this would be the right direction. We don't want to prevent the user from entering "major" but prevent arbitrary symbols/strings to be implicitly converted to a list. Users can pass scale definitions beyond the known \major \minor.



lilypond-user mailing list

reply via email to

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