From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id IEKJKJ47QWIqJQEAgWs5BA (envelope-from ) for ; Mon, 28 Mar 2022 06:37:50 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id aF9EIZ47QWLdTgEAG6o9tA (envelope-from ) for ; Mon, 28 Mar 2022 06:37:50 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3045E20F8A for ; Mon, 28 Mar 2022 06:37:50 +0200 (CEST) Received: from localhost ([::1]:54098 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nYh8W-0008Dm-Rd for larch@yhetil.org; Mon, 28 Mar 2022 00:37:48 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60196) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nYh7u-0008B7-W0 for guix-devel@gnu.org; Mon, 28 Mar 2022 00:37:11 -0400 Received: from mail-m975.mail.163.com ([123.126.97.5]:14312) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nYh7p-0006ga-IL for guix-devel@gnu.org; Mon, 28 Mar 2022 00:37:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version; bh=ofhMP s1ZKUZJvSykYBcG+nWphd1Q2Ot/+fyZflTaUck=; b=pHTj98LBe/DTObYWM4slF CKC3rV8+FT6itJfDpfbfWD9TttF737rQFh/q78sKNHeQfZc97N/XL0uZl5vneGAx xx+WQkHjSX0wm5Gqsy13bUggkcsuam6HeByws2ed3UZWGQ3/N/v5kyL6XgAGkcAl hYkEByjqk9RdnI5Gfv0Lto= Received: from asus-laptop (unknown [112.95.114.251]) by smtp5 (Coremail) with SMTP id HdxpCgA3W+lIO0FiPCYgIg--.126S2; Mon, 28 Mar 2022 12:36:27 +0800 (CST) References: <2067ba1e606855eace261fd0b0ae9721b369bbd5.camel@telenet.be> <753ba5897ed397b5e95175cd139137975245945b.camel@telenet.be> <6012789.Rgyoke53jH@bastet> <3493949.dX3coAEF3O@bastet> User-agent: mu4e 1.6.10; emacs 27.2 From: Zhu Zihao To: Philip McGrath Subject: Re: Semantics of circular imports Date: Mon, 28 Mar 2022 12:24:26 +0800 In-reply-to: <3493949.dX3coAEF3O@bastet> Message-ID: <86ilryr8wl.fsf@163.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-CM-TRANSID: HdxpCgA3W+lIO0FiPCYgIg--.126S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7Zr18KrW5Jw17AryfAr1fWFg_yoW5Jr1rpr WUuFnI93y0g3yDKan2yF15Ww1Sv3yftF4xG3s5ArsFvan5Wwn2vF1fKFs0vF1Uu34xJw1a qw4jvr98XF90yrJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07j8WrAUUUUU= X-Originating-IP: [112.95.114.251] X-CM-SenderInfo: pdoosuxxwbztlvw6il2tof0z/xtbBawzRr1et3vA89QAAsE Received-SPF: pass client-ip=123.126.97.5; envelope-from=all_but_last@163.com; helo=mail-m975.mail.163.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ricardo Wurmus , Liliana Marie Prikler , guix-devel@gnu.org Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1648442270; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=ofhMPs1ZKUZJvSykYBcG+nWphd1Q2Ot/+fyZflTaUck=; b=C0pjMly6XwFoix1IR7EL7yuQtu9dgy5ZHtUOA42+NkMz50fm74WRj1BZfGh6Xi0OTJBrk1 rXjbDW/RhVl1iI/sXfhuEZzNTQfSAoZVsPCsU8GWfuN/SuRN0Cr3habKzb1Pth/ydqPCpb d3/3lFAx2NVn1hVLYh5kTvwkF/CerflUj0H8Mz1ZsTXhGGxegJju9xNo2L+Pa/0ht41crO MTHMvHs2ftQaOLXfSQvEnJJFa3huTQLNAmPyfn51qDj4ralub7dd34/v3jkZcH/NDePQfL JXZWrWEFI8QrWshID+SH3VB57Q1JL2yZAEFoGHdcmbUID1Agg2dIWbK5pKx3pA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1648442270; a=rsa-sha256; cv=none; b=RsIO/o5bp6p5yfyS/HkxekL4s8u/VYqt1+jtvVng96l8uLV917bOwYUwQs3BP1sB9oO4cf QdJWs6Cf90fc3OUQXR2zI0bXvGUf/ZpEnRPv1SAxN29a6QDYrY8UuGLa/2KHi009c05FLf ptLvglEldG4toyA92aao7Eaakam07XE17ua9VeGHANaKuSfqSle8PSUK0ArV8+PsN92IAO CsZL4xU9kDpOIRgKdOIY1d+dXNj7aWUqDb+EUitYgV6AkqJe8e0l3ci6vAherKEOZPdna3 ayJiFAYTYIksJQPIaXenGfPYFpyQGTOJ1MyLGVsnWXCDZZUpsqGouH6/0bwvPQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=163.com header.s=s110527 header.b=pHTj98LB; dmarc=pass (policy=none) header.from=163.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -11.17 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=163.com header.s=s110527 header.b=pHTj98LB; dmarc=pass (policy=none) header.from=163.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 3045E20F8A X-Spam-Score: -11.17 X-Migadu-Scanner: scn0.migadu.com X-TUID: Yhw/ZpzXkk5N --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Philip McGrath writes: > Oh, wow. I definitely had not realized that, *even inside a declarative=20 > module*, a reference to a variable with no statically visible definition= =20 > would semantically be a dynamic lookup in a mutable environment at=20 > runtime (rather than a compile-time error), though I do see now that=20 > `info guile declarative` does indeed say that marking a module as=20 > declarative "applies only to the subset of top-level definitions that=20 > are themselves declarative: those that are defined within the=20 > compilation unit, and not assigned (=E2=80=98set!=E2=80=99) or redefined = within the=20 > compilation unit." It depends on how you reference to it. If a variable is referenced in the same module, it'll be inlined if it's small enough. If you reference it from another module, it'll do something like module-ref instead (works like non-declarative binding) > This seems like a big barrier to cross-module inlining, though IIUC Guile > currently doesn't do much of that by default (maybe for this reason). Guile 3.0.8 comes to rescue. It works by rewrite the `define-module` call and attach the tree-il of some bindings on it. For details, read the blog post authored by Andy Wingo https://wingolog.org/archives/2021/05/13/cross-module-inlining-in-guile TIPS: If you're interested in the implementation detail of Guile. You should not miss the Andy Wingo's blog post!=20=20 > The use of "top-level" to refer to definitions within a module is=20 > somewhat confusing to me. I usually understand "top-level" to refer to=20 > the kind of interactive REPL environment for which R6RS leaves the=20 > semantics unspecified. Racket uses "module-level variable" and "module=20 > context" in contrast to "top-level variable" and "top-level context" to > make this distinction.[1][2][3] (There are also R6RS "top-level=20 > programs", but I wouldn't think of those unless made very clear from=20 > context.) Top-level is the set of outermost brackets in a file :) The optimization pass related to the top-level in Guile is called letrectify. It rewrites the top-level bindings into a big letrec block. You can check the comment of (language tree-il letrectify) and it has a good example. Because top-levels can reference each other, so the evaluation order will not the same as the code order. =2D-=20 Retrieve my PGP public key: gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F Zihao --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iIsEARYIADMWIQRefA5qkqvnKdl/GTlmOX+E92aT+QUCYkE7KhUcYWxsX2J1dF9s YXN0QDE2My5jb20ACgkQZjl/hPdmk/nxYAD+OZANowok5qpCEyALUKDF8J2SacJF uSOIOGWUiDBvR6IBAIYRkh/q4KfDFB6PJO1xbh1Zygq0ISgSEcfkeasQi54D =FNGI -----END PGP SIGNATURE----- --=-=-=--