Philip McGrath schreef op zo 27-03-2022 om 10:12 [-0400]:
> The use of "top-level" to refer to definitions within a module is 
> somewhat confusing to me. I usually understand "top-level" to refer
> to 
> the kind of interactive REPL environment for which R6RS leaves the 
> semantics unspecified. Racket uses "module-level variable"  and
> "module 
> context" in contrast to "top-level variable" and "top-level context"
> to
> make this distinction.[1][2][3] (There are also R6RS "top-level 
> programs", but I wouldn't think of those unless made very clear from 
> context.)

In Guile, if you start a REPL, the REPL is inside some module.  By
default, this module is the (guile-user) module (or (guix-user), when
using "guix repl"), although this can be changed with ',m' and maybe by
stepping through the debugger (not sure).

As such, if you run (define foo 'bar) inside a REPL currently in
(guile-user), then this corresponds to defining a top-level
variable/module variable inside the (guile-user) module.

Summarised: REPL environments have a corresponding Guile module and in
Guile, there is no meaningful distinction between "top-level variable"
and "module variable", unlike in Racket.

Greetings,
Maxime.

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to