[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: guile-vm 0.4
From: |
Marius Vollmer |
Subject: |
Re: guile-vm 0.4 |
Date: |
09 May 2001 21:08:13 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.102 |
Martin Grabmueller <address@hidden> writes:
> > From: Dirk Herrmann <address@hidden>
> > Date: Tue, 8 May 2001 16:21:16 +0200 (MEST)
> >
> > On 11 Apr 2001, Marius Vollmer wrote:
> >
> > > [ I just reread the "Proper Tail-Recursive" section of R5RS, and I
> > > noticed that `eval' is required to be proper. That is,
> > >
> > > (define (loop)
> > > (eval '(loop) (current-module)))
> > > (loop)
> > >
> > > is supposed to not grow the stack. Do we want to fix that? This
> > > would kick out my loved `current-module' scheme...
> > > ]
> >
> > I had kept this in my mailbox with the hope to find some time to think
> > about it. But, unfortunately I don't seem to find the time. Thus the
> > question: In which way does a proper tail recursive implementation
> > conflict with the current-module scheme that guile's current module system
> > uses?
>
> I suspect that saving/restoring the current module while evaluating
> the expression will grow the stack (or, at least the dynamic-wind
> chain), even though saving/restoring is not strictly necessary in the
> example above.
Yes, but that was a false alarm on my part. We can keep the
save/restore semantics when implementing tail-calls to eval. When
such a tail-call happens, we can just replace the current module
without stacking another save/restore pair on the wind-chain. Maybe
we could make this into a general pattern that is not only available
for eval but for all uses of dynamic-wind...