From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Han-Wen Nienhuys Newsgroups: gmane.lisp.guile.devel,gmane.comp.gnu.lilypond.devel Subject: Re: definitions in macros? Date: Mon, 23 Mar 2020 08:21:12 +0100 Message-ID: References: <87v9mw9jwa.fsf@fencepost.gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="1010"; mail-complaints-to="usenet@ciao.gmane.io" Cc: lilypond-devel , Guile Devel To: David Kastrup Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Mon Mar 23 08:21:57 2020 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jGHPH-00005y-42 for guile-devel@m.gmane-mx.org; Mon, 23 Mar 2020 08:21:55 +0100 Original-Received: from localhost ([::1]:57916 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGHPF-0001mV-T9 for guile-devel@m.gmane-mx.org; Mon, 23 Mar 2020 03:21:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37856) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGHOw-0001m6-OH for guile-devel@gnu.org; Mon, 23 Mar 2020 03:21:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jGHOv-00042Q-Eo for guile-devel@gnu.org; Mon, 23 Mar 2020 03:21:34 -0400 Original-Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]:34031) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jGHOo-00040S-Mf; Mon, 23 Mar 2020 03:21:27 -0400 Original-Received: by mail-lf1-x12b.google.com with SMTP id e7so373528lfq.1; Mon, 23 Mar 2020 00:21:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wHeRuVloXaRdA3HnjqNeYshgCOCDlKgrzdjAF2/ywwo=; b=AWBzVoBMOiExygdpVTRQJKA6mIp2m2ZV3+o5NYgTJfiD0j8Kjdup9/vTkAf2bs9UHY PJG5kQdZSmcJ4TCMOSpYU2J/jUBYwWIJS+cQ0DW7jxOKTRNVs9mRgcRrKt7CNzE9FOZc R0WhY4udRDW6guObApHtzNdrYV9YzITf8ubRYLR+p/QWOxglXIG/4+F6uJknpamrNU8a 1q+2xcZj7QBMFqEuU7pzPC/Vp2VFcKhFbZDErZg3ncV46zBH+u+C9h04ghdDlezaYB94 6EibXG6XJf09BPVKw7Xzsg70bobKSdIR8aGo/3I2i12jKxGc5ticWGQBrbdLF5kM/Led ftGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wHeRuVloXaRdA3HnjqNeYshgCOCDlKgrzdjAF2/ywwo=; b=UUrWbpNRR8kxhgyKtDhFC5HbtDA6CK34x6pXcd3mGRUN+lLMqgRJ0NcQVa1zVYZJ8w /YUK/pyiCbQ8D+GdgDQhPdpTBtRoCgUmglNeRfZfLuy5o6xSBdNnKM/xIxbHSD63DR5k L2nDUv11D8Uzi2x/b6vHFAmJp24MYB51hTiEiKK/UAKEBKZePYc9fMkL/Mv4SSg5ykij IBqH23Txff4u+YI0IXHkl+jDhUA1BABfEU79sW2nTqHfNsx4e0wBofqEFL9nYO2TwEKV V8W48qfOBNvu0Kp2B9xIf6GUpts2dFu4xs8ptK4iaKiHa3P9rgiM9FIsThJLKVzZyDem EZIQ== X-Gm-Message-State: ANhLgQ1o306kHkLZMtQeHEkVCe3DgYguaFc2MxHuCCcjvVwgVIru2b6/ L9SXH/ysl0GIXaZIsImsEm5zXPZTB0M12J6P7fDPedei X-Google-Smtp-Source: ADFU+vuO3b6g6lktSHKLG9Fyy6z9XTa5ceAInzZuHB1jS9H0nYPvwwfUzXSlZ1r5REWgknlQPMX2PAAqcJRZv8Y4qx8= X-Received: by 2002:a05:6512:68b:: with SMTP id t11mr12546427lfe.214.1584948084251; Mon, 23 Mar 2020 00:21:24 -0700 (PDT) In-Reply-To: <87v9mw9jwa.fsf@fencepost.gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::12b X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:20458 gmane.comp.gnu.lilypond.devel:74343 Archived-At: On Sun, Mar 22, 2020 at 10:09 PM David Kastrup wrote: > > 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")) > > This is very much expected. The macro body contains two side-effect > free expressions (namely quoted lists) and returns the last one which is .. > You probably wanted something like > `(begin (define p ...) (define q ...)) d'oh! I am an idiot. Thanks, -- Han-Wen Nienhuys - hanwenn@gmail.com - http://www.xs4all.nl/~hanwen