From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?UTF-8?Q?Linus_Bj=C3=B6rnstam?= Newsgroups: gmane.lisp.guile.devel Subject: Re: unhandled constant? Date: Sat, 01 Feb 2020 16:21:43 +0100 Message-ID: <1953f8c7-3648-40d3-83ed-72a26d20e6ec@www.fastmail.com> References: <8d77f905-31e9-4d0b-973a-82be38360e07@www.fastmail.com> <877e16wolr.fsf@fencepost.gnu.org> <877e16v12n.fsf@fencepost.gnu.org> 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="54813"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Cyrus-JMAP/3.1.7-781-gfc16016-fmstable-20200127v1 Cc: guile-devel@gnu.org, Han-Wen Nienhuys To: "David Kastrup" Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Sat Feb 01 16:22:28 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 1ixubL-000E9j-UR for guile-devel@m.gmane-mx.org; Sat, 01 Feb 2020 16:22:28 +0100 Original-Received: from localhost ([::1]:47100 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ixubK-0007W4-R2 for guile-devel@m.gmane-mx.org; Sat, 01 Feb 2020 10:22:26 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44770) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ixub4-0007Vy-DR for guile-devel@gnu.org; Sat, 01 Feb 2020 10:22:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ixub3-0005zQ-5m for guile-devel@gnu.org; Sat, 01 Feb 2020 10:22:10 -0500 Original-Received: from out2-smtp.messagingengine.com ([66.111.4.26]:38749) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ixub1-0005l4-5c; Sat, 01 Feb 2020 10:22:07 -0500 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 66F4121903; Sat, 1 Feb 2020 10:22:05 -0500 (EST) Original-Received: from imap1 ([10.202.2.51]) by compute3.internal (MEProxy); Sat, 01 Feb 2020 10:22:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=veryfast.biz; h= mime-version:message-id:in-reply-to:references:date:from:to:cc :subject:content-type:content-transfer-encoding; s=fm1; bh=P2tie fYt7VGRhYBA0gvUVO8NekYgAD+v3QrRyXJaIpo=; b=A/QruBjXz9I15KQvsA2PI dp/GYPDc/QmZtxhada7cnZDDP9WkxdDkKcdoeva2RHPRt+0/YD82yRCkLsES+DOR KVotFlwPN4rWOs83rQ+sdh53jj35PzE6FNqfsWYqSg/SUlxyWK7H9Nju885OKH1r YjkV2QoAyc2NPlRy3OE6ld+ED9MYso4mrMD+HbZB92I5e6P5Tq09itIHO5wwbjUs F4l6qq/e8ans/W0Kqrb9hIR6BUtve0vhSrVSFvoYtPw1B1XsveI4pvHi1iaJFrY7 vqiCOY8ElNA3De+PHk3vHlWGOxQYd56QNbbFEex1heu7ZXsOkCbdkSoPI2BW48yS w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=P2tiefYt7VGRhYBA0gvUVO8NekYgAD+v3QrRyXJaI po=; b=n3ZIT4kMvSXO0MSZcQZvZI4brAyr0fL6JtFxYq3sAQNU2A9tn3bl03uGl H9sUnB+LpsPv3PZD/ySYOf5/LQ+4eqjmWEEc2zTDMHGAPwUhAHpJ3wX4F/r3z9AM K10pgsFl6kFa6a6WRCnigZ2qW/uHEA92jYek+M8hglktUtpjbdnx+nx5JgVTkXLI JvfnhU15ijP4V1o5MGbPc435QFlEN34h6O7CZ+g/zZr2JPmzAvsJ5AUpURoKToLm gES7NGpP7a9sfE4fdHrfP45OgqRY3/EXZbQuixbW/d0PVhwOpBFjyuGNvyCpWHBz 64wINhhdN+9oOnIEmkbQ25yEW0bBw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrgedvgdejgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtgfesthhqredtreerjeenucfhrhhomhepnfhinhhu shgpuehjnphrnhhsthgrmhcuoehlihhnuhhsrdgsjhhorhhnshhtrghmsehvvghrhihfrg hsthdrsghiiieqnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhf rhhomheplhhinhhushdrsghjohhrnhhsthgrmhesvhgvrhihfhgrshhtrdgsihii X-ME-Proxy: Original-Received: by mailuser.nyi.internal (Postfix, from userid 501) id 2EBC4C200A4; Sat, 1 Feb 2020 10:22:05 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface In-Reply-To: <877e16v12n.fsf@fencepost.gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.26 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:20374 Archived-At: tried it in a couple of syntax-case-enabled schemes (defmacro is impleme= nted using syntax-case in guile) and it doesn't work anywhere. The proce= dure ends up undefined everywhere. The # object ,inner points to doesn't exist at runtime becaus= e it is not defined anywhere in any meaningful way to the compiler. One = work-around would be to output the literal lambda in place of ,inner but= by then you should just output a (let ...) With the lambda in it and le= t the inliner take care of it. --=20 Linus Bj=C3=B6rnstam On Sat, 1 Feb 2020, at 15:23, David Kastrup wrote: > Linus Bj=C3=B6rnstam writes: >=20 > > On Sat, 1 Feb 2020, at 12:09, David Kastrup wrote: > >>=20 > >> Can you expand about the "expansion time and macro time separation"= ? > >>=20 > >> If we have > >>=20 > >> (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) > >>=20 > >> 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 (a= nd > >> accesses decl) which is only being defined at expansion time. > >>=20 > >> The error message, however, rather appears to complain about inner = being > >> undefined rather than the definition of inner referring to undefine= d > >> entities. > > > > > > I am not sure what is really the problem. Either the inner function = is > > not present at runtime due to separation of compile time and runtime= , > > or it is a result of how defmacro re-introduces the result of the > > macro into the syntactic context of the macro usage (where inner is > > not visible). Either way, having the inner definition in the macro > > output will solve the problem of it not being visible. >=20 > This fails when byte-compiling, so it would appear that the equivalent= > of >=20 > (defmacro ... > (define local-fun ... > `(,local-fun ...))) >=20 > is not able to represent the local (and thus ultimately anonymous) > function here. Whether this is a general shortcoming or is conditione= d > on local-fun calling functions not available at byte-compile time (in > which case those would need to get wrapped in eval-and-expand) I haven= 't > checked yet. >=20 > --=20 > David Kastrup >