Hi Lukas,

> consider the following example: I want to keep a book in a variable and
> use it as a function argument. But a variable containing a \book seems
> to fail to match the ly:book? predicate in function argument checking.

the issue is not the `ly:book?` predicate, as you can see by calling 
`#(display (ly:book? bookVariable))`. The problem lies in the parser. In fact 
passing `\useBook #bookVariable` will work. So the issue lies in how 
`\bookVariable` is parsed.

Further investigation shows that `\bookVariable` by itself is fine, but the 
error 
appears whenever this is bound to something. The easiest way to replicate this 
is to do `test = \bookVariable`. It seems like the parser is smart enough to 
not copy a module if it is called toplevel. But if a copy is necessary it 
seems to think that `bookVariable` is a header block, so it tries to create a 
new header from it and fails (since it is not a header). I suppose somewhere 
in the parser there is the assumption that every module is a header block.

And in fact, if you specifically tell the parser that this is a book by doing 
`\book { \bookVariable }` it works.

So I’d suggest:

* If you have no issue with working on the original object use #bookVariable
* If you want a copy use `\book { \bookVariable }`
* In any case, file a bug report.

Best regards,
Tina

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to