What's the point of make-continuation-mark-key?

31 views
Skip to first unread message

Jack Firth

unread,
Jan 11, 2020, 10:48:17 PM1/11/20
to Racket Users
Based on my reading of Continuation Frames and Marks, any value at all can be used as a key for a continuation mark. So why does make-continuation-mark-key exist, and why is there a special continuation-mark-key data type? Couldn't you use any arbitrary gensym, or a singleton struct? The docs for make-continuation-mark-key mention that the returned key can be impersonated and other kinds of keys can't, but they don't explain why that would be the case.

Matthew Flatt

unread,
Jan 11, 2020, 11:02:44 PM1/11/20
to Jack Firth, Racket Users
It would be reasonable to generalize `chaperone-continuation-mark-key`
to apply in cases where `chaperone-struct` could work, with similar
sorts of evidence that chaperoning is allowed provided by a caller of
`chaperone-continuation-mark-key`. I guess we just didn't think about
it that way when `chaperone-continuation-mark-key` was added, so it was
added in a way more like `chaperone-vector` and other chaperones that
apply to more specialized representations.

Other kinds of keys, like symbols, can't be impersonated because their
representations don't accommodate chaperones. (In other words, they're
like structs declared with `#:authentic`.)

At Sat, 11 Jan 2020 19:48:17 -0800 (PST), Jack Firth wrote:
> Based on my reading of Continuation Frames and Marks
> <https://docs.racket-lang.org/reference/eval-model.html#(part._mark-model)>,
> any value at all can be used as a key for a continuation mark. So why does
> make-continuation-mark-key
> <https://docs.racket-lang.org/reference/contmarks.html#%28def._%28%28quote._~23
> ~25kernel%29._make-continuation-mark-key%29%29>
> exist, and why is there a special continuation-mark-key
> <https://docs.racket-lang.org/reference/contmarks.html#%28def._%28%28quote._~23
> ~25kernel%29._continuation-mark-key~3f%29%29>
> data type? Couldn't you use any arbitrary gensym, or a singleton struct?
> The docs for make-continuation-mark-key mention that the returned key can
> be impersonated and other kinds of keys can't, but they don't explain why
> that would be the case.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/773a2caa-d6b3-48b8-becf-cc3105a6
> 60e0%40googlegroups.com.

Jack Firth

unread,
Jan 11, 2020, 11:37:28 PM1/11/20
to Racket Users
That makes sense. I think the thing that seems most confusing to me is that using the continuation-mark-key data type is optional. Why bother allowing arbitrary kinds of keys?

Sam Tobin-Hochstadt

unread,
Jan 11, 2020, 11:39:37 PM1/11/20
to Jack Firth, Racket Users
We created the continuation-mark-key data type in ~2011 to support Typed Racket. At that point, Racket had continuation mark support for more than a decade using other values as keys. 

Sam 

To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/9ac7e680-f32e-4a79-8cb7-4799ea5e953c%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages