guile-user
[Top][All Lists]
Advanced

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

Re: about coroutines


From: Keith Wright
Subject: Re: about coroutines
Date: Wed, 5 Dec 2001 00:49:38 -0500

> From: address@hidden
> 
> >>>>> "Marius" == Marius Vollmer <address@hidden> writes:

Marius> Do you think this is a bug on Guile's part, or is it
Marius> unavoidable?  I plan to find the precise location where the
Marius> continuation references stick...

Marius is my hero.

mibin>> Well, i don't think this can be regarded as a bug,  more
mibin>> of an intrinsic weakness...

If it's not a bug, then it is a feature that should be documented.
Who wants to put it in the manual? :

   Guile sometimes fails to execute a valid Scheme program, and
   instead segfaults after thrashing the OS into a stupor.  Some
   people have conjectured that it has something to do with a broken
   design for the garbage collecter, and that would be too much
   trouble to fix.  Maybe it won't happen to a progam that never
   uses call/cc.

Marius> Yes, but that would still be a bug, no?  Maybe we are just
Marius> doing something stupid in our implementation and we can
Marius> remove that leak by overwriting a stack slot in some
Marius> strategic place...

Hope so.  If you can't trust the GC you can't trust Scheme.
I wonder if it would help to add an extra level of indirection
in the representation of a continuation?  What tools are you
using to look at the problem?

mibin> The problem can be minimized, but not avoided completely,

You reached that gloomy conclusion with remarkably little
evidence; you must be using strong rules of inference.  Several
people (eg. me) have made ill-founded conjectures, speculations
actualy, as to what the problem might be.  Nobody even knows yet.

If you are refering to fact that "conservative" garbage collection
sometimes keeps garbage around, then I point out the difference
between keeping a bounded amount of garbage, or even O(n) garbage with
probability O(2^{-n}), or some such reasonable inefficiency, with
piling it up forever every time.

mibin> without reviewing much of the implementation design

So what's wrong with a review?  That need not mean throwing out
everything and starting over.  Making a change to the representation
of continuations or tightening the GC might require _no_ changes
to other code.  It's hard for me even to imagine code that relies
on such things in more than a couple of places and isn't fool's code.

mibin> (and, i assume, without slowing down the execution of common
mibin> code).

<diatribe on speed/correctness fetish deferred>

If you mean that nobody uses co-routines anyway, then I say that
call/cc, along with lambda, if, set!, quote, and apply, is one of the
core constructs of Scheme.  The raison d'etre for Guile is to get this
core right once and for all, so that libraries can be bolted on at
will without re-inventing the basic control and binding.

There has been a lot of interest in "threads".  What are they but
co-routines that yield control non-deterministically without explict
calls?  If the easy case is not rock-solid then how can the more
general situation work?

-- 
     -- Keith Wright  <address@hidden>

Programmer in Chief, Free Computer Shop <http://www.free-comp-shop.com>
         ---  Food, Shelter, Source code.  ---



reply via email to

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