You're trying to implement `amb` where a client can mix `amb` and `dynamic-wind` and get sensible behavior, right?
The `dynamic-wind` operation certainly interferes with building new control forms. Racket threads and other control forms that need to interact a certain way with `dynamic-wind` end up being built in at the same level as `dynamic-wind`. At Sat, 30 Nov 2019 06:15:16 -0600, Alexis King wrote: > Is there any way to do that with Racket’s continuation machinery, There's not a safe way. In many cases, Racket lets you write new things that have the power of built-in through unsafe APIs --- and it turns out that there are unadvertised procedures (provided by the primitive `#%unsafe` module) for this particular case: unsafe-abort-current-continuation/no-wind unsafe-call-with-composable-continuation/no-wind These are currently used to implement `ffi/unsafe/try-atomic`. Using the `/no-wind` operations will make `amb` interact with `dynamic-wind` in the way you have in mind, I think. At Sat, 30 Nov 2019 06:15:16 -0600, Alexis King wrote: > Also, is this kind of thing discussed anywhere in the literature? I don't know of any published work on this topic (so let me know if you find something!). As you probably have seen already, our ICFP'07 paper just points out that `dynamic-wind` causes problems, but doesn't try to hold `dynamic-wind` itself responsible for those problems. An opinion and some pointers to newsgroup discussions: http://okmij.org/ftp/continuations/against-callcc.html#dynamic_wind It would be interesting to check whether `dynamic-wind` is really needed in Racket libraries, at least in its current form. Most uses are really a "finally" mechanism that could be tied to explicit escapes like exceptions, instead of imposed for all continuation jumps. Maybe the uses that don't fit that pattern would be better expressed with another mechanism. Maybe the guarantees on `dynamic-wind` just need to be weakened and the `/no-wind` variants declared "safe" by defining away the unsafety. Matthew -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/5de2897c.1c69fb81.1d190.4683SMTPIN_ADDED_MISSING%40gmr-mx.google.com.