[racket] Confusing behavior with continuation-marks
There were two problems:
* `continuation-mark-set-first' wasn't correctly using the given
prompt tag to delimit the search for a mark (which explains the
wrong value for the first and fourth tests);
* the documentation was wrong, because the prompt-tag argument is
actually the fourth argument to `continuation-mark-set-first', and
the third argument is a default result for when the mark isn't
found (which explains the result in the last two tests).
These problems are now fixed in the repo.
At Sat, 15 Jan 2011 01:49:58 -0500, Eric Dobson wrote:
> I was looking at the documentation on how continuation-marks work, and
> the documented behavior is different than what I observed.
>
> The following programs add a continuation mark, then a prompt, then
> try to look at the current continuation marks. According to the
> documentation I would expect the programs not to find a continuation
> mark, but in some cases it does. Here are the 6 variations and their
> returned values.
>
>
> #lang racket
> (define key 'key)
> (define value 'value)
> (with-continuation-mark key value
> (call-with-continuation-prompt
> (lambda ()
> (continuation-mark-set-first
> #f
> key))))
>
> (with-continuation-mark key value
> (call-with-continuation-prompt
> (lambda ()
> (continuation-mark-set-first
> (current-continuation-marks)
> key))))
>
> (with-continuation-mark key value
> (call-with-continuation-prompt
> (lambda ()
> (continuation-mark-set-first
> (current-continuation-marks (default-continuation-prompt-tag))
> key))))
>
> (with-continuation-mark key value
> (call-with-continuation-prompt
> (lambda ()
> (continuation-mark-set-first
> #f
> key
> (default-continuation-prompt-tag)))))
>
> (with-continuation-mark key value
> (call-with-continuation-prompt
> (lambda ()
> (continuation-mark-set-first
> (current-continuation-marks)
> key
> (default-continuation-prompt-tag)))))
>
> (with-continuation-mark key value
> (call-with-continuation-prompt
> (lambda ()
> (continuation-mark-set-first
> (current-continuation-marks (default-continuation-prompt-tag))
> key
> (default-continuation-prompt-tag)))))
>
> =>
> 'value
> #f
> #f
> 'value
> #<continuation-prompt-tag:default>
> #<continuation-prompt-tag:default>
>
>
> -Eric