guile-devel
[Top][All Lists]
Advanced

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

Re: Bug in eval-string?


From: Marius Vollmer
Subject: Re: Bug in eval-string?
Date: 10 Aug 2002 16:18:20 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Matthias Koeppe <address@hidden> writes:

> > But "with" is such a nice name compared to "fluid-let"! ;) 
> 
> The name is *too nice* for something like FLUID-LET.  Remember, it
> uses DYNAMIC-WIND and lots of SET!s.  It is inefficient if CALL/CC
> is used.

Hmm, what is wrong with 'dynamic-wind' and 'set!'?

> It won't work in a threaded environment.

Really?  Whether or not the dynamic context established by "with" or
"fluid-let" is local to the current thread or gloabal to all depends
on the nature of the 'variable' that you are setting.  It could be a
fluid, or it could be an ordinray global variable.

> > I'd say that fluid-let should be in the core. Opinions?
> 
> I'd say, we should rather make SLIB integration smoother, and/or
> provide a SRFI-15 implementation (despite its withdrawn status).  
>
> Putting it in the core won't be a good idea IMHO.
> 
>  1)  It creates confusion because Guile knows real fluid variables.
>      FLUID-LET has "fluid" in its name but has no connection to
>      fluids.

That's actually one reason why I like "with".

>  2)  WITH-FLUIDS is much cleaner than FLUID-LET.  People should use
>      WITH-FLUIDS if they want (threadsafe) dynamic scoping.

But with-fluids is only for fluids, not for general dynamic scoping of
settable things.

> Moreover, for the application of switching modules by "dynamically
> binding" the place (CURRENT-MODULE), I think that using either your
> originally proposed "WITH" syntax or the FLUID-LET syntax are bad
> ideas because they suggest simple variable assignments, whereas
> changing the current module is a much heavier thing.

Yes, setting the current-module can have far reaching consequences,
but so could setting an ordinary variable.  In fact, setting the
current module is implemented by setting a variable (well, a fluid).
Since "with" or "fluid-let" is distinct from "let" there is no
immediate danger of someone accidentally setting the current module
with it (unlike in Common Lisp (when the *special* convention isn't
followed)).

So I don't see how offering "fluid-let" or "with" is dangerous.  It
might not be 'pure', but it offers something that people want to use.
having to use dynamic-wind explicitely is cumbersome and error prone
compared to fluid-let, in my view.




reply via email to

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