guile-user
[Top][All Lists]
Advanced

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

Re: Dynamic variable binding


From: Ludovic Courtès
Subject: Re: Dynamic variable binding
Date: Thu, 13 Nov 2008 19:50:45 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux)

Hello,

Sebastian Tennant <address@hidden> writes:

> The macro definition I was searching for is simply this:
>
>  (define-macro (definer var val) ;var must be a symbol
>    `(module-define! (current-module) ,var ,val))
>
> Wrapped within a 'for-each' this macro allows me to bind as many
> variables as a like in a single stroke.
>
> Why not use the module namespace as a top-level hash table Dale?  Isn't
> that essentially what a module namespace is, or at least what it's for?
>
> Is there a really good reason to avoid doing this?

Dynamic binding definition is compilation-unfriendly.  Kjetil's proposed
`define-lotsof' macro is more appropriate, as it can be fully evaluated
at compile-time (should a compiler be used, that is), whereas the
`module-define!' trick requires that compilation and execution be the
one and same phase.

Thanks,
Ludo'.





reply via email to

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