lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange difference between Lilypond and Guile plain


From: David Kastrup
Subject: Re: Strange difference between Lilypond and Guile plain
Date: Thu, 08 May 2014 17:12:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

"R. Mattes" <address@hidden> writes:

> Dear list,
>
> I just stumbled over a strange problem. I'm trying to use some of
> my guile code from within Lilypond. When trying to import some of
> my macros (when and unless) into Lilypond I get the following error:
>
> ,---- LilyPond RELP ---------------------------------
> | guile> (load "syntactic-shugar.scm")
> | <unnamed port>: In expression (void):
> | <unnamed port>: Wrong type to apply: #<Music function #<procedure #f (parser
> location arg)>>
> | ABORT: (misc-error)
> `----
>
> Here ias the code:
>
> ,---- file syntactic-shugar.scm ---------------------
> | (use-syntax (ice-9 syncase))
> |
> | (define-syntax when
> |   (syntax-rules ()
> |     ((when condition expression ...)
> |      (if condition (begin expression ...)))))
> |
> | (define-syntax unless
> |   (syntax-rules ()
> |     ((unless condition expression ...)
> |      (if (not condition) (begin expression ...)))))
> `----
>
> The same code works without problems in guile itself.
>
> Lilypond version: "2.19.5"
> Guile version: "1.8.8"
>
> Any idea what's going on?

Yes.  LilyPond defines a music function \void, and (ice-9 syncase) gets
confused by that for whatever stupid reason (the bug is reported, but
don't expect any 1.8 releases any more).  Guile 2.0 works but of course
that is of little consolation.  I think there are command line options
for "preloading" some Scheme files: those might work before \void gets
defined.

Other than that, you can put
(define-module (scm syntactic-shugar) #:use-syntax (ice-9 syncase)
  #:export-syntax (when unless))

at the top of your file, and

(use-modules (scm syntactic-shugar))

after loading it.

Basically, keep syncase from seeing the LilyPond main module when
loading it.

-- 
David Kastrup



reply via email to

[Prev in Thread] Current Thread [Next in Thread]