[racket] Behavior of continuation-mark-set-≥list and continuation-mark-set-first with respect to key values

From: Galler (lzgaller at optonline.net)
Date: Tue May 8 02:26:09 EDT 2012

> but continuation marks are carefully designed to avoid breaking tail
> recursion (they let you understand the tail behavior of your program,
> more accurately) so that's why you see only one binding.


Yes. That is exactly what happened.

On further inspection, I was using with-continuation-mark in two
 different contexts. 

In the first context, successive calls to w-c-m were tail recursive
and current-continuation-mark-set->list returned a  single binding
to the key.

In the other context, successive calls to w-c-m were **not**
 tail-recursive and continuation-mark-set->list returned multiple
 bindings to [a different] key. 

This code was implemented first and I thought it was 'normal'.

I do think you alerted me to the tail-recursive w-c-m behavior back 
at Christmas-time when we were discussing replacing dynamic-wind with
with-continuation-mark to support Jay's stateless web language
(#lang web-server). 

>>they let you understand the tail behavior of your program

Y. this unintentionally demonstrated that the most deeply nested
portion of the project is tail-recursive.

Also, the new _with-continuation-marks_ syntax is highly useful. 

Thanks for all the help and generosity.


Posted on the users mailing list.