From: Marius Vollmer <mvo@zagadka.ping.de>
Cc: guile-devel@gnu.org
Subject: Re: Bug in eval-string?
Date: 21 Aug 2002 21:26:12 +0200 [thread overview]
Message-ID: <878z30t3mz.fsf@zagadka.ping.de> (raw)
In-Reply-To: <uw5bs7xlpx5.fsf@saturn.math.uni-magdeburg.de>
Matthias Koeppe <mkoeppe@mail.Math.Uni-Magdeburg.De> writes:
> Marius Vollmer <mvo@zagadka.ping.de> writes:
>
> > But fluids are by far not the only thread-local things that one might
> > want to bind dynamically. You could also have some data structure
> > that is pointed to by some thread-local global variable and you might
> > want to dynamically bind a slot of this structure. Or this structure
> > might be shared by a group of cooperating threads and setting a field
> > in it would thus affect all of them.
>
> I think it is already a very bad idea to think about temporarily
> mutating slots of data structures as "binding". See also below.
Then you can't think about 'with-fluids' as performing 'bindings' as
well. That is OK, and a better term would maybe be 'letting', or
'setting temporarily'. We should'nt quarrel over names too much, tho.
> The good thing about fluids is that they are regular Scheme values.
> This means that we can put them not only in global variables but also
> in lexical variables and other data structures. The WITH-FLUIDS
> syntax also deals with those fluids, not only with fluids stored in
> global variables.
Yes, this is a good point, one that can be used against using
variables in general. fluid-let might be bad in the sense that it
allows people to work with things besides fluids and doesn't force
them to use fluids exclusively. But that is a weak argument in my
view since I don't think that fluids are the only things that should
be temporarily set. Especially things that are layered on top of
fluids.
> > [...]
> > Being able to say
> >
> > (fluid-let (((busy) #t))
> > ...)
> >
> > looks very attractive to me (and is entirely correct because "busy" is
> > correct, not because fluid-let is somehow thread-safe).
>
> It doesn't look attractive to me. I am afraid people will simulate
> control structures via getters and setters. BUSY is the first step
> into this direction. This will lead to a C++-ish overloading mess,
> where you never know what an operation will do unless you know exactly
> the type of the objects involved.
I don't think it is that bad. The behavior of fluid-let is not
changed by the things that are being 'let'. Of course you need to
know what 'busy' does.
> The Scheme way would be to make a new control procedure
>
> (with-being-busy THUNK)
>
> or/and a macro.
How would you implement with-being-busy? Something like fluid-let
would sure come in handy. Also, in addition to with-being-busy you
would still need a getter to be able to find out whether you are
currently busy.
Factoring this into an abstract state variable that can be read and
written, and a general construct that can temporarily set any abstract
variable looks good to me, still. You only need to learn fluid-let
once.
> >> What "general settable things" did you have in mind?
> >
> > Structure slots, for example. See above.
>
> I was afraid you would say that. I think it is very bad style to make
> temporary mutations on data structures. It's not getting better if
> you mutate named slots rather than mutating the CADDR as in the
> example code I gave above.
This depends entirely on what you want to do. There are algorithms
that are most efficient when you modify data structures (as opposed to
coding them in a functional way). Some modifications might be
temporarily (i.e., the 'dancing links' of Knuth).
> The only reason why I would be interested in a Guile-based
> implementation of Emacs is the hope for a clean, thread-safe Lisp
> engine, which would allow for a multi-threaded Emacs. We can't reach
> this goal if we copy all the inherently single-threaded stuff
> (swapping in and out values, as with FLUID-LET) from the Emacs Lisp
> engine into Guile.
I still don't see how fluid-let ruins multi-threaded applications.
The current buffer needs to be thread-local, but code like
(fluid-let ((case-fold-search #f))
...)
would still need to be used. We can debate whether that should rather
be
(fluid-let (((buffer-local-value case-fold-search) #f))
...)
or
(fluid-let (((case-fold-search) #f))
...)
or something different, but the point to discuss is the exposition of
Emacs variables to Scheme, not whether we should be able to set them
temporarily. A general fluid-let construct can only help with
experimenting. Only allowing an unchanged with-fluids constrains the
options too much, too early, I'd say.
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
next prev parent reply other threads:[~2002-08-21 19:26 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-08 12:56 Bug in eval-string? rm
2002-08-08 21:03 ` Marius Vollmer
2002-08-09 9:06 ` Matthias Koeppe
2002-08-09 9:19 ` Marius Vollmer
2002-08-09 10:24 ` Matthias Koeppe
2002-08-10 14:18 ` Marius Vollmer
2002-08-12 18:20 ` Matthias Koeppe
2002-08-13 0:39 ` Marius Vollmer
2002-08-14 19:07 ` Marius Vollmer
2002-08-17 11:09 ` Neil Jerram
2002-08-20 11:39 ` Matthias Koeppe
2002-08-21 19:26 ` Marius Vollmer [this message]
2002-08-27 14:18 ` Emacs variables (was: Bug in eval-string?) Matthias Koeppe
2002-08-31 13:51 ` Marius Vollmer
2002-08-08 21:27 ` Bug in eval-string? Neil Jerram
2002-08-09 9:35 ` rm
2002-08-10 14:43 ` Marius Vollmer
2002-08-12 10:49 ` rm
2002-08-13 20:55 ` Marius Vollmer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878z30t3mz.fsf@zagadka.ping.de \
--to=mvo@zagadka.ping.de \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).