guile-devel
[Top][All Lists]
Advanced

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

Re: Non-stack-copying call-with-current-continuation?


From: Andy Wingo
Subject: Re: Non-stack-copying call-with-current-continuation?
Date: Sun, 04 Mar 2012 13:15:56 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

Hi David,

On Sun 04 Mar 2012 13:01, David Kastrup <address@hidden> writes:

> The global symbol space is a different identity space than heap
> equality, and it never gets garbage collected: the lifetime of a
> gensym is eternal.

This is not true in Guile, where symbols can be garbage collected.

> I am not dismissing his suggestions.  I am saying that I find call/ec a
> nicer primitive than catch/throw exactly because it does not need a name
> or symbol to work but has its identity and life-time coupled to an
> object rather than a symbol.

OK.

> And frankly: the manual talks about prompts being composable and gives
> an example which seems utterly wrong to me since it does not actually
> abort a computation but rather half-finishes it.  It is unclear what
> part of the computation will finish and what will complete.

That is an interesting point.  I guess there are two ways of answering
it.  One is to note that in Scheme, it's difficult in general to
determine whether a computation is finished or will finish, because of
call/cc.

But you ask about a specific point, here: an abort to a prompt is
basically boils down to a longjmp to the prompt's handler.  The partial
continuation is logically passed as an argument to the handler.  I say
"logically" because, if Guile can prove that the continuation is not
referenced, then it no continuation is reified.  In practice, that means
that if the handler is of the form (lambda (k . other-args) FORM), and
FORM does not reference `k', then an abort to that prompt does not cause
the stack to be captured.

We should probably say something in the manual about this.  (We should
probably also add higher-level interfaces like call/ec and generators,
as well.)

Regards,

Andy
-- 
http://wingolog.org/



reply via email to

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