This is the mail archive of the guile@sources.redhat.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: continuation and multi-threading


Miroslav Silovic <silovic@zesoi.fer.hr> writes:

> > Hmm, right.  I didn't think of it.  I think I have to export all local
> > variables within a closure that uses call/cc as external variables.
> > This is not so hard, but very inefficient.
> 
> You may have problems with the upward closures. As I understand your
> VM, it would restore -all- the local variables in -all- the stack
> frames on stack copy.
> 
> The problem is that Scheme -really- relies on environments being a
> tree.

Maybe.

  (lambda (foo)                         ;; closure 1
    (lambda ()                          ;; closure 2
      (call/cc (lambda (cont) ...)))
    foo)

`foo' is local to closure 1 and won't be exported, but may be changed
several times if cont is called several times.  So I have to export it,
too.  As a result, all variables that appear after call/cc must be
exported.  But I think I can do that.

The needs of exported (or external) variables are relatively rare.
Most variables are really local and temporary.  I want to somehow try
to optimize this...  (If I couldn't, that's an experience :)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]