unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Han-Wen Nienhuys <hanwenn@gmail.com>
To: Guile Devel <guile-devel@gnu.org>
Cc: lilypond-devel <lilypond-devel@gnu.org>
Subject: definitions in macros?
Date: Sun, 22 Mar 2020 20:07:11 +0100	[thread overview]
Message-ID: <CAOw_e7bVfgmrMf-ZtjF4zJqESLS1Y6CbHNztxcvfiEYwX5PzwQ@mail.gmail.com> (raw)

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,
why?

(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)


thanks,

-- 
Han-Wen Nienhuys - hanwenn@gmail.com - http://www.xs4all.nl/~hanwen



             reply	other threads:[~2020-03-22 19:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-22 19:07 Han-Wen Nienhuys [this message]
2020-03-22 19:16 ` definitions in macros? Matt Wette
2020-03-22 21:09 ` David Kastrup
2020-03-23  7:21   ` Han-Wen Nienhuys

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOw_e7bVfgmrMf-ZtjF4zJqESLS1Y6CbHNztxcvfiEYwX5PzwQ@mail.gmail.com \
    --to=hanwenn@gmail.com \
    --cc=guile-devel@gnu.org \
    --cc=lilypond-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).