[racket] Confusing behavior with continuation-marks
The fix seems to work, but it doesn't work for the value
parameterization-key exported by #%paramz.
(require '#%paramz)
(define value 'value)
(define (test key)
(with-continuation-mark key value
(call-with-continuation-prompt
(lambda ()
(continuation-mark-set-first
#f
key)))))
(test 'key)
(test parameterization-key)
I originally came about this because I was trying to understand how
prompts acted with parameterizations. Is this key a known special case
due to low level hackery, or is this also a bug?
-Eric
On Sat, Jan 15, 2011 at 10:08 AM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> 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
>
>