[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: can't export conditional variable set with 'cond'
From: |
M |
Subject: |
RE: can't export conditional variable set with 'cond' |
Date: |
Thu, 1 Feb 2024 15:53:37 +0100 |
>I think this has something to do with compilation indeed. More specifically,
>it is caused by cross module inlining [1]. You probably need to declare your
>env module as not declarative by setting #:declarative? to #f inside the
>define-module form of env. I think the compiler inlines varB somehow. Not
>super sure, I am no Guile expert but you could inspect the assembly for main
>to see what the compiler did.
You shouldn’t need to do that – definitions / variables that are set! within
the same module are (modulo bugs, which apparently exist) are (supposedly)
recognised as non-declarative:
>To allow Guile to reason about the values of top-levels from a module, a
>module can be marked as declarative. This flag 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.
> By default, modules are compied declaratively if […].
(Technically it doesn’t say that the compiler will actually act according to
this flag, but I think it’s clear what’s meant here.)