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:
Parsing.../usr/share/lilypond/2.18.2/ly/music-functions-init.ly:564:11:
In procedure ly:music-transpose in expression (ly:music-transpose
(make-music # # ...) tonic):
/usr/share/lilypond/2.18.2/ly/music-functions-init.ly:564:11: 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
specifications.
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.
Suggestions?
Well, I can bump that rather easily (using existing predicates) to
gag.ly:2:10: error: wrong type for argument 2. Expecting list of number pairs, found
"major"
\key c
major
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
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user
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.