[Top][All Lists]

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

Re: definitions in macros?

From: Matt Wette
Subject: Re: definitions in macros?
Date: Sun, 22 Mar 2020 12:16:46 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 3/22/20 12:07 PM, Han-Wen Nienhuys wrote:
Hi there,

in my quest to get lilypond working with GUILE 2+, I've hit another
stumbling block.

In order to make compilation with GUILE 2+ working, we have to move
away from runtime symbol definition (ie. module-define! calls).

In the code below, it looks like only one of the two definitions in
the body of my-macro-new takes effect. Is this expected, and if so,

(defmacro-public my-macro-old (command-and-args . definition)
   (module-define! (current-module) 'x1 "I am X1\n")
   (module-define! (current-module) 'x2 "I am X2\n"))

(defmacro-public my-macro-new (command-and-args . definition)
     `(define p "i am P\n")
     `(define q "i am Q\n"))

(my-macro-old 1 2)
(my-macro-new 1 2)
(display x1)
(display x2)
(display q)
(display p)


Try the following.  Not sure about defmacro but define-syntax must return a single form.

(defmacro-public my-macro-new (command-and-args . definition)
      (define p "i am P\n")
      (define q "i am Q\n")))

reply via email to

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