Piers Cawley <[EMAIL PROTECTED]> wrote: > Leopold Toetsch <[EMAIL PROTECTED]> writes:
>> Klaas-Jan Stol <[EMAIL PROTECTED]> wrote: >>> Hello, >> >>> I've been playing with closures and subs but I have a little bit of >>> trouble with those. >> >> newsub $P0, .Closure, _foo >> $P0(q) >> newsub $P0, .Closure, _foo >> $P0(q) >> >> Closures have to be distinct. > Does this *really* mean that, if I create a closure in a function and > return it to my caller, that closure can only be invoked once? No, it can be invoked as often you like. But above case seems to be different and very similar to what I already asked: (define (choose . all-choices) (let ((old-fail fail)) (call-with-current-continuation You remember that snippet, it's now a test in t/op/gc.t. I had to insert the line below XXX and use a second closure, which has the "arr2" in it's context. newsub choose, .Closure, _choose x = choose(arr1) # XXX need this these closures have different state newsub choose, .Closure, _choose y = choose(arr2) The question was, if that's technically correct. leo