I looked at the code for a while again and think I now begin to understand it a 
bit more:

I did not know `(let/ec` so I had to read about it. It says, that it is 
equivalent to `(call/ec proc` or something, which is equivalent to 
`(call-with-escape-continuation ...`. Uff … I don't know much about 
continuations, except from a vague idea of when they are called. The idea gets 
mingled with structures in other programming languages which are "catching 
exceptions" and such stuff. I don't know this stuff, so I guess 
`(call-with-escape-continuation` works like catching an exception, which is not 
really an exception, but just a signal, that code is returning. Then instead of 
simply returning, the escape continuation is called. This is done implicitly 
without specifying a named exception for returning and without defining some 
conditional structure on the side where it would return to.

This could all be wrong and all I found was the following very unhelpful 
https://lists.racket-lang.org/users/archive/2010-October/042356.html where it 
links me to some paper (https://www.cs.indiana.edu/~dfried/appcont.pdf), which 
I have no motivation to read in its entirety, even if it's probably really 
clever stuff. Maybe that is the actual reason: Fearing that I wont understand 
any of it in depth. It also includes some exercises, which seem to be really 
difficult.

However, with this kind of idea about escape continuations in mind, I think I 
get the idea behind using `(let/ec` in the code. When a place wants to exit, it 
is stopped from doing so, giving it more work, as if to say: "Hey wait! You can 
escape, but only if you do THIS! (escape continuation)" Then the place, 
desperately wanting to escape thinks: "Damn, OK, I'll do just that little bit 
of code more.", not realizing, that it is stuck in a loop. How mean.

I wonder however, if there is no simpler way of doing this.

I mean, if `(place-channel-get ...)` blocks, could I simply put stuff into an 
endless loop without escape continuation and only break the loop, if a certain 
symbol is received on the channel?

Since `(place-channel-get ...)` is blocking, it should not generate any CPU 
load, when there is no message on the channel (right?).

Why do I need to introduce something as complex as `(let/ec ...)`?

I appreciate the code shared here. I just hesitate to use it, when I don't even 
understand it myself or when I am super unsure about understanding it (escape 
continuations). I am also thinking about how I can replace all the exclamation 
mark procedures, before adding it to my other code, which does not deal with 
assignments so far.

Is there some easy to understand introduction to continuations in Racket? (not 
a super clever and scientific Friedman paper, which I'd probably need 1 year to 
actually understand :D)

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to