Re: Obscure error message from 2.25.0

2023-01-15 Thread Graham King

On 2023-01-15 19:30, Jean Abou Samra wrote:

Le 15/01/2023 à 20:20, Graham King a écrit :
I've just run convert-ly on a 600+ line file and its \include files, 
from 2.19.40 to 2.25.0.  Nothing seemed to change apart from the 
\version statement, but on trying to compile the file, I get:


Processing `/tmp/ly'
Parsing...ERROR: In procedure %resolve-variable:
Unbound variable: %
Exited with return code 1.

Does this point to an obvious problem?




You probably tried to use LilyPond comment syntax in a Scheme function.
Scheme comments start with ';' not '%'.


[snip]

Thanks Jean, you nailed the problem.



Re: Obscure error message from 2.25.0

2023-01-15 Thread Jean Abou Samra

I forgot the second part of the question:

Le 15/01/2023 à 20:20, Graham King a écrit :

Before I start laboriously bisecting the file, is there a way to get an error 
message that points to one or more lines of code in the file?



Try

#(ly:set-option 'compile-scheme-code)

(Caveat: not functional under Windows currently)


OpenPGP_signature
Description: OpenPGP digital signature


Re: Obscure error message from 2.25.0

2023-01-15 Thread Jean Abou Samra

Le 15/01/2023 à 20:20, Graham King a écrit :

I've just run convert-ly on a 600+ line file and its \include files, from 
2.19.40 to 2.25.0.  Nothing seemed to change apart from the \version statement, 
but on trying to compile the file, I get:

Processing `/tmp/ly'
Parsing...ERROR: In procedure %resolve-variable:
Unbound variable: %
Exited with return code 1.

Does this point to an obvious problem?




You probably tried to use LilyPond comment syntax in a Scheme function.
Scheme comments start with ';' not '%'.

With Guile 1, as used in LilyPond 2.22, it happens that

#(define (func)
   % a bunch of unbound variables
   'x)

#(display (func))


"works" and prints "x". This is weird. The function body has several
expressions: %, a, ..., 'x, where all the ones before 'x are references
to variables called '%', 'a', ... In Scheme, the expressions before the
last one in a function body are evaluated only for their side effects, the
result is discarded. It seems that Guile 1 somehow detects that a
simple variable can't have a side effect and removes it, even
though it would trigger an error if it were evaluated.

We're on Guile 2 now, and it doesn't have this obscure behavior.

Best,
Jean



OpenPGP_signature
Description: OpenPGP digital signature


Obscure error message from 2.25.0

2023-01-15 Thread Graham King
I've just run convert-ly on a 600+ line file and its \include files, from 
2.19.40 to 2.25.0.  Nothing seemed to change apart from the \version statement, 
but on trying to compile the file, I get:

Processing `/tmp/ly'
Parsing...ERROR: In procedure %resolve-variable:
Unbound variable: %
Exited with return code 1.

Does this point to an obvious problem?
Before I start laboriously bisecting the file, is there a way to get an error 
message that points to one or more lines of code in the file?

Grateful for any help

-- Graham