Hi, if we write xxx in LilyPond, this is considered to be a string. I want xxx.yyy.zzz to be a list of strings ("xxx" "yyy" "zzz"). The main incentive is to be able to have music functions be able to accept both Stem as well as Staff.TimeSignature as a function argument.
At the current point of time, we have the following abomination: alterBroken = #(define-music-function (parser location name property arg) (string? scheme? list?) (_i "Override @var{property} for pieces of broken spanner @var{name} with values @var{arg}.") (let* ((name (string-delete name char-set:blank)) ; remove any spaces (name-components (string-split name #\.)) (context-name "Bottom") (grob-name #f)) (if (> 2 (length name-components)) (set! grob-name (car name-components)) (begin (set! grob-name (cadr name-components)) (set! context-name (car name-components)))) [...] #{ \override $context-name . $grob-name $property = [...] to be used as \alterBroken "Staff.OttavaBracket" #'padding #'(1 3) % Spaces in spanner's name are disregarded. \alterBroken "Staff . OttavaBracket" #'style #'(line dashed-line) \ottava #1 % It is possible to use procedures as arguments. \alterBroken Hairpin #'stencil #`( [...] With that change, it could be written as alterBroken = #(define-music-function (parser location name property arg) (string-list? symbol? list?) (_i "Override @var{property} for pieces of broken spanner @var{name} with values @var{arg}.") #{ \override #name #property = arg [...] and used as \alterBroken Staff.OttavaBracket #'padding #'(1 3) \alterBroken Hairpin #'stencil #`( [...] Basically, if a music function wants to provide a shorthand for an override, not being able to specify an optional context is a nuisance. I currently have just the same problem writing a \hide function that is supposed to be a shortcut for \override ??? #'stencil = ##f . Using periods to build a string list seems reasonably straightforward to me. It would happen in the parser rather than the lexer, so spaces are allowed and it should not cause conflicts with chord modifiers and other awkward stuff. What do you think? -- David Kastrup _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel