Ticket #1521 (closed bug: fixed)
Continuations interact badly with .return
Reported by: | arnsholt | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | none | Version: | trunk |
Severity: | medium | Keywords: | |
Cc: | Language: | ||
Patch status: | Platform: | darwin |
Description
I'm trying to implement non-deterministic search (backtracking), for a tentative continuation-passing Prolog on Parrot. Fiddling with this, I've stumbled upon what seems like a strange issue with continuations.
The code is adapted from the Scheme in Paul Graham's On Lisp.
test.pir contains my original test code. As is clear from the output, choose() gets the right value, but the calling code somehow always gets the first value.
In an attempt to condense the code a bit I wrote bug.pir, which exhibits some interesting behaviour. The return value keeps the value from the last return. Possibly the continuation resumes from a slightly wrong position?