This is the mail archive of the
guile@sources.redhat.com
mailing list for the Guile project.
Re: How often are continuations created?
Mikael Djurfeldt <mdj@mdj.nada.kth.se> writes:
> > guile> (do ((v (make-vector 5 #f))
> > (i 0 (1+ i)))
> > ((= i 5))
> > (vector-set! v i (magic-computation i))
> > (display i))
> > 01234guile> (some-cont #f)
> > 01234guile>
> >
> > Which one is the correct behavior?
>
> Miroslav is right.
> Guile is wrong.
Really? Hmm... I understood why Marius pointed out this example.
I have two choices:
1. To allocate all mutable variables in external frames whether or
not they are accessed by continuations.
2. To export mutable variables dynamically when they are accessed
by continuations. Rebuild the bytecode, too!
Probably it is possible to do some optimization, but I'll use 1 for
the moment. Maybe I'll add a compilation option that disables the
continuation support for performance.
I hate continuations after all :)