Re: partial k design

Matthias Radestock <[email protected]> Tue, 16 Nov 2004 23:28:57 +0000
Newsgroups gmane.comp.java.sisc.devel
Message-ID <[email protected]>
Chris Double wrote:

> On Tue, 16 Nov 2004 18:02:40 +0000, "Matthias Radestock"
> <[email protected]> said:
> 
>>To implement partial continuations I propose the following new primitives
> 
> 
> This sounds great! Would this design support nested calls to 'reset' and
> using call/pc to get a partial continuation for the outside reset's
> mark?
> 
> (reset 
>   (lambda ()
>     (reset  
>       (lambda ()
>         (call/pc 
>            (lambda (k1)
>               ...k1 would be the partial continuation for the inner
>               reset. How would I get the outer reset from here?...)))))
> 

You can't do that.

There is an alternative design where you can:

(reset <one-arg-proc>)
...<one-arg-proc> gets called with a unique marker object.

(abort <marker> <thunk>)

(call/pc <marker> <one-arg-proc>)


The problem here is that <marker> may refer to a reset point that is not 
part of the current computation, which would be an error. I dislike APIs 
that do that sort of thing, particularly since there is no way to find 
out in advance whether a marker is valid. I suppose we could introduce a 
marker-valid? predicate, but that would make the API even more complicated.

I haven't made up my mind on this issue yet though. Any "real world" 
examples of the utility of the extended functionality are very much 
appreciated.


Matthias.



-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8