guile-devel
[Top][All Lists]
Advanced

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

Re: catch, throw, prompt, control, fluids, garbage collection


From: Andy Wingo
Subject: Re: catch, throw, prompt, control, fluids, garbage collection
Date: Mon, 15 Feb 2010 23:07:40 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux)

Hi,

A brief note.

On Sun 14 Feb 2010 13:33, Andy Wingo <address@hidden> writes:

> I am currently shaving a yak.

I wrote more about the yak:
http://wingolog.org/archives/2010/02/14/sidelong-glimpses

In it I concluded,

    I need an efficient with-fluids, some pieces of prompt and abort,
    and to add that all to the bootstrap language of Guile, and I have
    it.

So, regarding fluids:

> The problem: Well, you might want to set some exception handlers, and
> then spawn a bunch of threads all with those handlers. But if a
> pre-unwind handler throws an exception, that exception shouldn't be
> handled by itself, or you get an infinite loop. Basically you need a bit
> to say whether a given handler is running in a given thread or not -- a
> fluid.

It should probably be thread-local, but it doesn't need to be
per-exception-handler -- a thread-local weak hash or even a list would
be fine.

At the same time, I came to the conclusion that Guile's current
implementation of fluids is best. With Emacs we really want shallow
binding, and we can store a pointer to the fluid vector (dynamic state)
in the VM's data itself, so accessing fluids can be quite fast.

It will need to be documented that currently fluids can't be collected,
and if users need collectable fluids, they should use an indirection
(like a fluid containing a weak key hash table).

See also:
    http://www.gnu.org/s/emacs/manual/html_node/elisp/Impl-of-Scope.html
and
    
http://www.franz.com/support/documentation/8.0/doc/multiprocessing.htm#wide-binding-1.

I'm close to having the problem solved, but it will take another couple
weeks. Also I haven't gotten to NEWS this evening. Sorry!

Ciao,

Andy
-- 
http://wingolog.org/




reply via email to

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