I'm going to reword it to "the magic of dynamic-wind" so that people like me who hadn't yet learned of it won't think they have to do anything special, vs. the Scheme implementor who wrote dynamic-wind along with call/cc etc.
----- Original message -----
From: John Cowan <email@example.com>
Date: Wednesday, August 14, 2019 5:13 PM
Not really. That's Olin's original language.
Date: Wednesday, August 14, 2019 4:48 PM
Providing that behavior is part of the with-raw-mode etc. spec, so
only a crash, (emergency-exit) or the like will potentially leave your
terminal in a messed up state.
Exactly. The thunk passed to with-raw-mode is wrapped in a dynamic-wind that enables raw mode in the before-thunk and disables it in the after-thunk.
The SRFI says:
The following procedures use
dynamic-wind magic when executing their
thunk arguments; if the thunk's dynamic extent is escaped, the action of the procedure is undone, but if the thunk's dynamic extent is re-entered, the action of the procedure is re-enabled.
Although is there anything "magic" about this, vs. it being standard usage and behavior of dynamic-wind?