guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Semantics of circular imports


From: Maxim Cournoyer
Subject: Re: Semantics of circular imports
Date: Wed, 30 Mar 2022 00:50:45 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hello,

Zhu Zihao <all_but_last@163.com> writes:

> Philip McGrath <philip@philipmcgrath.com> writes:
>
>> Oh, wow. I definitely had not realized that, *even inside a declarative 
>> module*, a reference to a variable with no statically visible definition 
>> would semantically be a dynamic lookup in a mutable environment at 
>> runtime (rather than a compile-time error), though I do see now that 
>> `info guile declarative` does indeed say that marking a module as 
>> declarative "applies only to the subset of top-level definitions that 
>> are themselves declarative: those that are defined within the 
>> compilation unit, and not assigned (‘set!’) or redefined within the 
>> 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

Thanks for the interesting read (nice writing from Wingo, as usual :-)).

Maxim



reply via email to

[Prev in Thread] Current Thread [Next in Thread]