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 Subject: Re: unhandled constant? Date: Fri, 31 Jan 2020 18:50:35 +0100 Message-ID: References: <8d77f905-31e9-4d0b-973a-82be38360e07@www.fastmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="124344"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-devel@gnu.org To: =?UTF-8?Q?Linus_Bj=C3=B6rnstam?= Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Fri Jan 31 18:55:20 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 1ixaVk-000WJ3-F0 for guile-devel@m.gmane-mx.org; Fri, 31 Jan 2020 18:55:20 +0100 Original-Received: from localhost ([::1]:57394 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ixaVj-0003kn-E0 for guile-devel@m.gmane-mx.org; Fri, 31 Jan 2020 12:55:19 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44199) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ixaRO-0003ub-7j for guile-devel@gnu.org; Fri, 31 Jan 2020 12:50:51 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ixaRM-0001MY-TU for guile-devel@gnu.org; Fri, 31 Jan 2020 12:50:50 -0500 Original-Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]:45453) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ixaRM-0001JS-NQ for guile-devel@gnu.org; Fri, 31 Jan 2020 12:50:48 -0500 Original-Received: by mail-ot1-x32a.google.com with SMTP id 59so7329716otp.12 for ; Fri, 31 Jan 2020 09:50:48 -0800 (PST) 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:content-transfer-encoding; bh=Ro9LJGZHZ3WymCpf1NvzcZlTbqDQtbkj3g4kU0Cd2zk=; b=tJWeIEI8lGhceDbbLHepbTIGNez5PHEwF2rLApEN8eUuHI890JQuiBrxUjn1p+0UeB 9cl8lvZyuosaXAXHmidOoBXbSlFqs74dz6VU4drUX9iH6jRPkPkocVu8KBVE2kMHn7h/ tg+LRoYTJASCSBZ6FQx4LpekhY07aSzdO73sYx40X8Ii6dic88XssBn8gEjLooPcNQIx esjYasrHUGyYfmmIBIO0QFX6mb+36IleOWupqoMGOEdErJ1RWXFRiJChr8JNmPfzrVjC 5kM0jr2mhNSNMX3xgtW9QLeHPMMA6U7g2k751/zvzPYZs8lTFbB4foRxajFUoV3QahVy Lnbw== 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:content-transfer-encoding; bh=Ro9LJGZHZ3WymCpf1NvzcZlTbqDQtbkj3g4kU0Cd2zk=; b=qhoBaUxuGKeBfZQdcT21U0aDBaYgAlZ97F3IG6ca/w16IF6ul8fr2zIk3f/kBpxfCu /i3YD4nmLnn4BbW3CH1k9ds/eDLy7LXNxOFoWZ6+a1JUptienmucThjtd5YEm3o0jS2X rZjuP+auhkdQInr1C9tZShFiyA2WIbrkdAdIwE4xw6YExT8V/0jB4vqk5hIt2GX77KU+ GS/RFIjZu5XR9metYbUn8P2S5OWFFVnRuoM5WFn/ovs/Jj7LAo6bsuB0hEKROSeE3QIm uHAESHb/XacIhE3Nahw4n956WOF4eJA3nLuS/asxeSxzIRtegnoIEQJXFM+fX9JHWq0K kAQw== X-Gm-Message-State: APjAAAWwGcSgDeFzzldysYyJGzCbrDgo6Y/PUwlzVv/DRdW9gGQYy+Pn Q+gwNkW9LsUYduDxBkFllqjzdKTQLnqd9/Hdpmf4vT3SNsr1Ug== X-Google-Smtp-Source: APXvYqxMnrAekNhELuhsnk+ffKH9Y8JU3XPheNsZJWShj6FrZYJv2wOzDN0RfNH/5gTD5wK10AhLlUmuUgLi4m9B1Es= X-Received: by 2002:a05:6830:160c:: with SMTP id g12mr8241120otr.82.1580493047827; Fri, 31 Jan 2020 09:50:47 -0800 (PST) In-Reply-To: <8d77f905-31e9-4d0b-973a-82be38360e07@www.fastmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::32a 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:20359 Archived-At: On Fri, Jan 31, 2020 at 3:58 PM Linus Bj=C3=B6rnstam wrote: > > Guile1.8's macros are run-time macros: they are executed directly and not= transformed to output code that is then compiled. That is the reason why y= our code works: to newer guiles the (inner ...) is only available at expans= ion time. The macro output is trying to call code that does not exist at ru= ntime! When is the code executed? If have complex set of macros to define a special type of functions (so called markup commands). Some of these refer to other markup commands through a macro. What I can observe that some of the functions involved are not called during the compilation, but others are. In particular, the function that registers a markup command using something= like (module-define! (current-module) (string->symbol (format #f "~a-markup" name)) defn)) but this function is not called during the compile There is a convenience macro that is called within some function bodies, that does get called. Unfortunately, the latter convenience macro is expanded and then executed; the execution tries to then do (module-ref (current-module) (string->symbol (format #f "~a-markup" name) which fails. > For this to be working code the (inner ...) function needs to be availabl= e in the macro expansion. I didn't read through exactly what you are trying= to do, but try outputting a let: > > `(let ((inner (lambda (n v) (set ! ...)))) > (inner ,name ,value)) > > I doubt you can make the old code work in newer guiles, since I doubt any= scheme is a s lax about expansion time and macro time separation. > -- > Linus Bj=C3=B6rnstam > > On Wed, 29 Jan 2020, at 00:08, Han-Wen Nienhuys wrote: > > Some of the lilypond Scheme files do the following: > > > > > > (define decl '()) > > (define (make-var n v) (list "var" n v)) > > (defmacro define-session (name value) > > (define (inner n v) > > (set! decl > > (cons > > (make-var n v) > > decl)) > > ) > > `(,inner ',name ,value)) > > (define-session foo 1) > > (display decl) > > (newline) > > > > In GUILE 2.2, this yields > > > > ;;; WARNING: compilation of /home/hanwen/vc/lilypond/q.scm failed: > > ;;; unhandled constant # > > > > What does this error message mean, and what should I do to address the = problem? > > -- > > Han-Wen Nienhuys - hanwenn@gmail.com - http://www.xs4all.nl/~hanwen > > > > --=20 Han-Wen Nienhuys - hanwenn@gmail.com - http://www.xs4all.nl/~hanwen