Hello,

On Sat, Feb 16, 2013 at 4:18 PM, Mark H Weaver <m...@netris.org> wrote:

> Hi Noah,
>
> > On Sat, Feb 16, 2013 at 2:14 PM, Mark H Weaver <m...@netris.org> wrote:
> [...]
> >     Noah Lavine <noah.b.lav...@gmail.com> writes:
> >
> > You mean if a function modifies another function that called it.
>
> There are many other cases.  Think multiple threads, coroutines, logic
> programming systems, etc.  That's why I wrote "stack(s)".  Actually, I
> should have written "(partial) continuation(s)".  There are any number
> of ways that an activation record for some procedure you modify could
> still be alive somewhere in the heap.  The issue can arise even with
> simple lazy data structures.  I don't think it's something we should
> punt on.  IMO anyway.
>
> What do you think?
>

Yes, you're right. I hadn't thought about those cases. This is a tricky
question.

But before we continue, are you sure that the right semantics is to modify
all of the continuations? In particular, let's say you have a function like
this:

(define (func x)
  (+ x 2 (my-special-function x)))

And my-special-function captures its continuation, k. Later on, you modify
func to be this:

(define (func x)
  (+ x 2))

Now what is the continuation k supposed to do? That continuation doesn't
exist in the latest version of func. I think in this case you have to treat
it like a closure that is still holding on to the continuation that it was
passed (conceptually, at least) when it was called. So it would return to
the old version of func.

On the other hand, take the same example, but this time redefine "+"
instead of "func". Now, does the continuation k call the new definition of
+, or the old one?

These really are questions for me. I don't know what the correct behavior
here is, but I think that if we can answer both of these questions, then we
know more or less what the correct thing to do is.

Noah

Reply via email to