Ticket #1521 (closed bug: fixed)

Opened 12 years ago

Last modified 12 years ago

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?

Attachments

test.pir Download (1.2 KB) - added by arnsholt 12 years ago.
Original code
bug.pir Download (1.2 KB) - added by arnsholt 12 years ago.
(Slightly) condensed code.

Change History

Changed 12 years ago by arnsholt

Original code

Changed 12 years ago by arnsholt

(Slightly) condensed code.

Changed 12 years ago by bacek

  • status changed from new to closed
  • resolution set to fixed

Issue was resolved in pcc_hackatron branch. Test added in r45123. Resolving ticket.

Note: See TracTickets for help on using tickets.