guile-devel
[Top][All Lists]
Advanced

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

Re: Mutable top-level bindings


From: Ludovic Courtès
Subject: Re: Mutable top-level bindings
Date: Sat, 20 Apr 2013 16:00:32 +0200
User-agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.3 (gnu/linux)

"Chris K. Jester-Young" <address@hidden> skribis:

> On Mon, Apr 15, 2013 at 10:00:55PM -0400, Mark H Weaver wrote:
>> Unfortunately, this is rarely possible in a language like Scheme, where
>> calls to procedures bound by mutable top-level variables are frequent.
>> We cannot fix this without making most commonly-used top-level bindings
>> immutable.  Last I checked, there was strong resistance to this idea.
>
> Maybe it's time to reopen this (and hope it's not a can of worms). :-)
>
> With a proper module system, I don't see why top-level bindings should
> be mutable.

[...]

> Yes, this does disable the ability to perform monkey-patching. I don't
> see this as a big loss, but perhaps there are legitimate use cases for
> monkey-patching that I haven't thought of.

Several uses cases would need to be addressed:

  - Uses of ‘set!’ for bootstrapping purposes as in boot-9.scm (I found
    myself using a similar idiom in
    <http://git.sv.gnu.org/cgit/libchop.git/tree/guile2/chop/internal.scm>
    because I couldn’t come up with another approach.)

  - Patching, as in
    <http://git.sv.gnu.org/cgit/guix.git/tree/guix/build/download.scm#n173>,
    where we’re able to work around a Guile bug without actually
    bundling a copy of the fixed module.

  - Live development (with Geiser), as Mark noted.  ProofGeneral does
    something interesting, where evaluated forms become immutable in the
    file, and have to be “de-evaluated” in reverse order to become
    mutable again.  That provides additional consistency guarantees, but
    remains far less flexible than what Scheme has to offer.

> Another thing we will need to provide is define-values,

+1

Thanks,
Ludo’.




reply via email to

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