[racket] Peekable asynchronous channel?

From: Eli Barzilay (eli at barzilay.org)
Date: Mon Aug 12 18:52:49 EDT 2013

An hour ago, Hendrik Boom wrote:
> On Mon, Aug 12, 2013 at 04:11:14PM -0400, Eli Barzilay wrote:
> > An easy way to get around such things is to add a level of
> > indirection: wrap the original channel in another one where you
> > implement your own peeking.
> 
> Once you peek, if you decde that's not what you want, might you want
> to let independent threads peek the same element and decie they do
> want it?
> 
> There's got to be some kind of rejecting release if a peek holds the
> stream until accepted.

The point is that the wrapper reads as usual, and it implements the
peeking -- so in the wrapper there is no need to release the the
value.


10 minutes ago, Robby Findler wrote:
> Guys: the main thing to keep in mind when programming with CML is
> that you can jut build your own sync abstractions easily. 
> 
> In this case you would have a separate thread that mediates all
> access to one of these channels and that makes it easy to get such
> concerns right.
> 
> Don't just rely on the built in abstractions tho!

Yes -- that.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the users mailing list.