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.comp.gnu.lilypond.devel,gmane.lisp.guile.devel Subject: Re: unhandled constant? Date: Sat, 1 Feb 2020 10:56:29 +0100 Message-ID: References: <8d77f905-31e9-4d0b-973a-82be38360e07@www.fastmail.com> <07e36ec2-0c0c-4786-9040-ffcb3418e0bb@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="22023"; mail-complaints-to="usenet@ciao.gmane.io" Cc: lilypond-devel , guile-devel@gnu.org To: =?UTF-8?Q?Linus_Bj=C3=B6rnstam?= Original-X-From: lilypond-devel-bounces+gnu-lilypond-devel=m.gmane-mx.org@gnu.org Sat Feb 01 10:56:53 2020 Return-path: Envelope-to: gnu-lilypond-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 1ixpWG-0005ao-9n for gnu-lilypond-devel@m.gmane-mx.org; Sat, 01 Feb 2020 10:56:52 +0100 Original-Received: from localhost ([::1]:37326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ixpWF-00088k-Bq for gnu-lilypond-devel@m.gmane-mx.org; Sat, 01 Feb 2020 04:56:51 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39948) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ixpWB-000861-4D for lilypond-devel@gnu.org; Sat, 01 Feb 2020 04:56:48 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ixpW9-0001Ug-Sn for lilypond-devel@gnu.org; Sat, 01 Feb 2020 04:56:47 -0500 Original-Received: from mail-ot1-x342.google.com ([2607:f8b0:4864:20::342]:39197) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ixpW7-0001R1-6a; Sat, 01 Feb 2020 04:56:43 -0500 Original-Received: by mail-ot1-x342.google.com with SMTP id 77so9062733oty.6; Sat, 01 Feb 2020 01:56:42 -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=UKdGEOriC3lGcvZ+/YNE8Y2fI5t01kdmnX5EBQnD8OA=; b=Cnw85+ch9EXbhDhQ92ffs0zE5Bf/89aWdgsgphAsbxLw45VPu56SeODvyO7Ss9TQVa KV80ZZY1cRfGFWjfXYKwMf4YoUeZ/0lVbP9RnCM0Zzov4UvrTARMIepTQQDJ8oxfQoWb HOabEy2Qp2x0pLTFWYckw7NdXODHhufwdRod+JsO0ovFh7kFd7TOA6HTKBmSzbujERKA wgx9rg19ypQuKilRjAmS6OwJaxMAcCgMGssAjeubexvZxWUHk4YO4JepsEqztAuwqkZ4 97x+vrE/Qb1JC0DpdJvKkZ6NjlPGLJN6Pyz+IHckgCV/CX4kZqQl1lnDQ/70O7E+5lDl D3KQ== 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=UKdGEOriC3lGcvZ+/YNE8Y2fI5t01kdmnX5EBQnD8OA=; b=hwWCNSfQa+lxOJXiSKP5hSneE2ViOI/aEm8NlJpdDMUFWgDJmRDoe50TiYNuusEYKa nwbB75GsZ7spRSs14IdagRArQ5zNF1Zgg5CHRWfhOyE/a/lMw+faCfbFKXxD7oXLQdTI HyrzOK2cbkvTx20/TMDgxz9QP1HvgW5J8+65Dl0zOicf3eLx49sty4cG8wwXrApYhJHt 43M6CR8iUJqJ6xmUAFX+184YIddh9Y/NAOPIA6PeJUgQXv17czslQZ/M/K3Z7d6ZVbNY 0Dih824iO9OZnXTIjfFcyRhixk4+7ZsFiNc5vVSTGXoZnzBOjF95v/QbVPRf75A0IfPF mtig== X-Gm-Message-State: APjAAAVYbI07BT//qsLkVB7d0qa2qfMuHtbnR6pYHJ55lKxBGgdS8Du9 jDpfL5zHpnOZ8XBp4S+Cq41uhjVU73WiB4SqLRw= X-Google-Smtp-Source: APXvYqyvRbMwLj4S5RSeNeG/xAHMIEdlY22h6+e1ArNhPChRSvlhwz7GymYkKgM96QtjoOeG1OGJw9EH075XnloRc9o= X-Received: by 2002:a05:6830:2111:: with SMTP id i17mr10299265otc.24.1580551002000; Sat, 01 Feb 2020 01:56:42 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::342 X-BeenThere: lilypond-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions on LilyPond development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lilypond-devel-bounces+gnu-lilypond-devel=m.gmane-mx.org@gnu.org Original-Sender: "lilypond-devel" Xref: news.gmane.io gmane.comp.gnu.lilypond.devel:72481 gmane.lisp.guile.devel:20366 Archived-At: +lilypond-devel for visibility. On Sat, Feb 1, 2020 at 10:54 AM Han-Wen Nienhuys wrote: > > Here is an example that shows better how things work, and what might > be the cause of my problems. Is it right that programmatically set > contents of "current-module" are not serialized into the compiled > file? > > (define (run-at-compile-time cmd) > (module-define! (current-module) (string->symbol cmd) #t) > (format (current-error-port) "I-am-called-at-compile-time ~a\n" cmd)= ) > > (define (runtime-call cmd) > (format (current-error-port) "I-am-called-at-runtime ~a\n" cmd) > (format (current-error-port) "val ~a\n" > (module-ref (current-module) (string->symbol cmd)))) > > (defmacro foo (cmd . rest) > (run-at-compile-time cmd) > `(runtime-call ,cmd)) > > (foo "xy") > > $ guile1.8 ew.scm > I-am-called-at-compile-time xy > I-am-called-at-runtime xy > val #t > > this is compatible with 2.2 without compilation, > > $ GUILE_AUTO_COMPILE=3D0 guile2.2 ew.scm > I-am-called-at-compile-time xy > I-am-called-at-runtime xy > val #t > > but compilation fails > > $ GUILE_AUTO_COMPILE=3D1 guile2.2 ew.scm > ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=3D0 > ;;; or pass the --no-auto-compile argument to disable. > ;;; compiling /home/hanwen/vc/lilypond/ew.scm > ;;; WARNING: compilation of /home/hanwen/vc/lilypond/ew.scm failed: > ;;; Unbound variable: run-at-compile-time > > $ guild2.2 compile ew.scm > Backtrace: > In system/base/target.scm: > 57:6 19 (with-target _ _) > In system/base/compile.scm: > .. > Unbound variable: run-at-compile-time > > > If I encapsulate the run-at-compile-time definition with > > (eval-when > (compile eval) > > it works if I remove the module manipulation, but the module-ref > doesn't work. It looks like the settings from module-define! are not > serialized into the byte code, so I can't have code that relies on > correspondence between module-define driven from macros and module-ref > during evaluation. > > [hanwen@localhost lilypond]$ guild2.2 compile ew.scm > I-am-called-at-compile-time xy > wrote `/home/hanwen/.cache/guile/ccache/2.2-LE-8-3.A/home/hanwen/vc/lilyp= ond/ew.scm.go' > [hanwen@localhost lilypond]$ GUILE_AUTO_COMPILE=3D0 guile2.2 ew.scm > I-am-called-at-runtime xy > Backtrace: > 6 (apply-smob/1 #) > In ice-9/boot-9.scm: > 705:2 5 (call-with-prompt ("prompt") # =E2=80=A6) > In ice-9/eval.scm: > 619:8 4 (_ #(#(#))) > In ice-9/boot-9.scm: > 2312:4 3 (save-module-excursion #) > 3832:12 2 (_) > In ew.scm: > 10:10 1 (runtime-call "xy") > In unknown file: > 0 (scm-error misc-error #f "~A ~S ~S ~S" ("No variabl=E2=80=A6= " =E2=80=A6) =E2=80=A6) > > ERROR: In procedure scm-error: > No variable named xy in # > --=20 Han-Wen Nienhuys - hanwenn@gmail.com - http://www.xs4all.nl/~hanwen