From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: David Kastrup Newsgroups: gmane.lisp.guile.devel Subject: Re: unhandled constant? Date: Sat, 01 Feb 2020 12:09:36 +0100 Message-ID: <877e16wolr.fsf@fencepost.gnu.org> References: <8d77f905-31e9-4d0b-973a-82be38360e07@www.fastmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="35030"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: guile-devel@gnu.org, Han-Wen Nienhuys To: Linus =?iso-8859-1?Q?Bj=F6rnstam?= Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Sat Feb 01 12:09:51 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 1ixqet-00091o-Ut for guile-devel@m.gmane-mx.org; Sat, 01 Feb 2020 12:09:51 +0100 Original-Received: from localhost ([::1]:45056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ixqes-0003Bc-Ub for guile-devel@m.gmane-mx.org; Sat, 01 Feb 2020 06:09:50 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58080) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ixqei-000394-Ee for guile-devel@gnu.org; Sat, 01 Feb 2020 06:09:41 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:36047) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ixqei-0000hh-0a; Sat, 01 Feb 2020 06:09:40 -0500 Original-Received: from x2f45ef2.dyn.telefonica.de ([2.244.94.242]:35558 helo=lola) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ixqeh-0005Vq-K8; Sat, 01 Feb 2020 06:09:39 -0500 In-Reply-To: <8d77f905-31e9-4d0b-973a-82be38360e07@www.fastmail.com> ("Linus =?iso-8859-1?Q?Bj=F6rnstam=22's?= message of "Fri, 31 Jan 2020 15:57:41 +0100") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:20368 Archived-At: Linus Bj=F6rnstam writes: > 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 your code works: to newer guiles the (inner ...) is only > available at expansion time. The macro output is trying to call code > that does not exist at runtime! > > For this to be working code the (inner ...) function needs to be > available 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. Can you expand about the "expansion time and macro time separation"? If we have (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) as stated, the local function "inner" is defined at macro time, but the form `(,inner ',name ,value) does not export the _name_ inner but rather the defined function. That part naively appears to me like it should work; an "expansion time and macro time" issue appears rather to be that inner calls make-var (and accesses decl) which is only being defined at expansion time. The error message, however, rather appears to complain about inner being undefined rather than the definition of inner referring to undefined entities. Can you clarify? --=20 David Kastrup