From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Maxime Devos Newsgroups: gmane.lisp.guile.devel,gmane.comp.gnu.guix.devel Subject: Re: A lexical use-modules? Date: Tue, 29 Mar 2022 16:59:06 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-Iqu+sPi+/eZD00JzV+qN" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26002"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.38.3-1 To: guile-devel@gnu.org, guix-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Tue Mar 29 17:00:00 2022 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 1nZDKB-0006ZH-Qy for guile-devel@m.gmane-mx.org; Tue, 29 Mar 2022 16:59:59 +0200 Original-Received: from localhost ([::1]:42228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZDKA-0006Lm-Px for guile-devel@m.gmane-mx.org; Tue, 29 Mar 2022 10:59:58 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:46236) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZDJX-0006DF-Ew for guile-devel@gnu.org; Tue, 29 Mar 2022 10:59:19 -0400 Original-Received: from [2a02:1800:120:4::f00:13] (port=52762 helo=baptiste.telenet-ops.be) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nZDJV-0003B2-57 for guile-devel@gnu.org; Tue, 29 Mar 2022 10:59:19 -0400 Original-Received: from [10.45.5.151] ([193.190.253.145]) by baptiste.telenet-ops.be with bizsmtp id CEzA2701138zUG101EzC0u; Tue, 29 Mar 2022 16:59:12 +0200 In-Reply-To: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1648565952; bh=12CwShiCmXRJ9FyOfcQ9OxRCfu+EqSQKY1VmRXCJFDg=; h=Subject:From:To:Date:In-Reply-To:References; b=gjhphuxLBVSYixayp9mYCYwRgvYm0Yv9WXHof4GzBIQzjFZnVtrSQw26QpCrdAeeZ PQxtyF7jkklqwH8nniPNDvrK6zkiFzz7YmrUAsLLnsyzqC3Fo7WifD6xx26MERFT3P ILtRsBlPEINZHOP64KaiDRC/+Ynji4rSbBI0QsWYMbUGsHQlKp+ZKETASgo7D9lLsu miQij3hyv7L3kzMmiXeXPiQp7K9ap9Ish3Berov9mm5H1b1Ap8dW4kWeBwu7Au+YMJ HhwoVbKIU4aMhU3xOtD4auCvk3Yja2r1p48s0FFugwMij/+JZOXFS6Apxw9Vs+9MK1 2KGq5Wp7hIraQ== X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a02:1800:120:4::f00:13 (failed) Received-SPF: pass client-ip=2a02:1800:120:4::f00:13; envelope-from=maximedevos@telenet.be; helo=baptiste.telenet-ops.be X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 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:21183 gmane.comp.gnu.guix.devel:62021 Archived-At: --=-Iqu+sPi+/eZD00JzV+qN Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Maxime Devos schreef op za 26-03-2022 om 20:21 [+0100]: > (define-syntax use-module/lexical > =C2=A0 ;; todo: integrate into (use-modules ...)? > =C2=A0 (lambda (s) > =C2=A0=C2=A0=C2=A0 (syntax-case s () > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ((_ foo) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (let* ((module-name (syntax->datum #= 'foo)) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 (interface (resolve-interface module-name))) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (define (binding->import= name variable) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (define name= -syntax (datum->syntax s name)) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #`(define-sy= ntax #,name-syntax (identifier-syntax (@ foo > #,(datum->syntax #'irrelevant name))))) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #`(begin #,@(module-map = binding->import interface))))))) This probably does not interact perfectly with 'syntax-parameterize', 'bound-identifier=3D?'/'free-identifier=3D?' and 'syntax-local-binding', though I guess it is good enough for most practical purposes. Greetings, MAxime. --=-Iqu+sPi+/eZD00JzV+qN Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYkMeuhccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7nwfAP9FRU4xZsQLri8FSFIAqD5PN6p6 uARKke7HT2K5LI4yTAD8CgbCrnxQwk38q6jvSURNZ0OsGs7/MdU7OokUxaNyeg4= =+DoE -----END PGP SIGNATURE----- --=-Iqu+sPi+/eZD00JzV+qN--