`call-in-continuation` and immediate continuation marks

Open
#907 4 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Domain
backend

Research direction

Start by reading the continuation mark implementation and its tests; the issue does not name specific files or test cases. Reproduce the final expression and compare its result with the preceding examples. Done means the immediate continuation mark lookup inside the thunk passed to call-in-continuation returns tail.

Written by the indexing model from the issue text.

Description

Consider the following expression:

(call/cc
  (lambda (k1)
    (call-in-continuation k1
      (lambda ()
        (call/cc
          (lambda (k2)
            (eqv? k1 k2)))))))

It evaluates to #t, which reflects the fact that the last expression of the thunk argument to call-in-continuation is evaluated in the continuation of the whole expression.

This, however, is not reflected by the implementation of immediate continuation marks. Consider:

(with-continuation-mark 'key 'tail
  (call/cc
    (lambda (k1)
      (call-with-immediate-continuation-mark 'key values))))

This expression evaluates to tail, which reflects the fact that key is part of the immediate table of marks of the continuation of the whole expression.

Now consider:

 (with-continuation-mark 'key 'tail
    (call/cc
      (lambda (k1)
        (call-in-continuation k1
          (lambda ()
            (call-with-immediate-continuation-mark 'key values))))))

In the current implementation of continuation marks, this evaluates to #f. In other words, the implementation of call-with-immediate-continuation-mark fails to deliver the immediate marks of the continuation to the call of the thunk argument to call-in-continuation.

Dominant language
Scheme
Stars
7.4k
Forks
1k
Avg merge
1d 20h
Merged PRs (30d)
19

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cisco/ChezScheme

All issues in cisco/ChezScheme

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.