Hi all,
I'm suffering from a weird problem which I think is related to the
dotted-list notation. It is very annoying because it blocks an important
merge on the way towards a unified library infrastructure. Unfortunately
I can't produce a minimal working example, as it seems that the problem
is buried in the multiple dependencies my function has. But I can easily
point you to the actual code.
Well, I do have a minimal example outlining what I want to do, but
"unfortunately" this works exactly as expected:
\version "2.19.16"
testDotList =
#(define-void-function (parser location opts path)
((ly:context-mod?) list?)
(for-each
(lambda (p)
(display p)
(newline))
path))
\testDotList path.to.whatever
\testDotList \with {
optionOne = ##t
optionTwo = ##f
}
path.to.something.else
\relative {c' }
There is a function taking an optional context-mod and a list as
arguments, followed by two different calls to it. Of course the example
doesn't do anything useful, but I mainly wanted to show the function's
signature and the calls. The actual code is in openLilyLib, on a
development branch:
The function useModules is defined in
https://github.com/openlilylib/openlilylib/blob/general-interface/ly/_internal/module-handling.ily
starting on line 233. The example of a call I'm going to discuss is in
https://github.com/openlilylib/openlilylib/blob/general-interface/ly/scholarly/usage-examples/diplomatic-line-breaks.ly
(If you should have stumbled over this in an archive and the links are
not working anymore this means the branch has been merged).
To access the code in its real form do the following
- update openlilylib with git pull
- checkout the general-interface branch
- open the files
- ly/_internal/module-handling.ily
- ly/scholarly/usage-examples/diplomatic-line-breaks.ly
- make sure both the openlilylib root and the ly directory inside are in
LilyPond's search path.
When you can compile the second file you're good to go.
As it is the file compiles fine, but when I comment out line 13 (the
pointless "ly:message") the compilation results in errors starting with
<included string>:1:1 <0>: error: unknown escaped string: `\include'
which can be tracked down to line 284 of module-handling.ily.
If I insert a music expression between the call to \useModule and the
\markup I get loads of errors starting with
openlilylib/ly/scholarly/diplomatic-line-breaks.ily:3:1 <0>: error:
syntax error, unexpected \header
If I prepend the music expression with a \relative clause I get yet
other errors, starting with
openlilylib/ly/scholarly/diplomatic-line-breaks.ily:3:1 <0>: error:
syntax error, unexpected \header, expecting (backed-up?)
So the function behaves (breaks) differently depending on what comes
after it. If I uncomment the ly:message line or insert e.g. a #(define
foo 'bar) between \useModule and the music expression or the markup
everything works as expected again.
So this is the first indicator that somehow LilyPond or Guile don't
reliably determine when the list? argument has finished.
This assumption is backed up by trying to change the dotted-list
notation to regular Scheme list notation. If I change line 10 to
\useModule #'(scholarly diplomatic-line-breaks)
everything works as expected, regardless of what comes after that.
So I don't know:
- is there anything in the implementation of useModules that could
(validly) cause something in the list interpretation to go wrong that way?
- is there an issue with the list? predicate itself?
- is there an issue with the LilyPond parser not being able to reliably
processing the input in the function call?
Any ideas or solutions would be greatly appreciated. The workaround to
simply add some Scheme expression after the list is inacceptable as it
will be exposed to the end user. And (as said) this bug is blocking an
important merge.
TIA
Urs
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel