[e-lang] makeMultiChannel (was EProxyResolver and ...)

Kevin Reid kpreid at mac.com
Sat Mar 24 17:21:44 CDT 2007


On Mar 23, 2007, at 19:47, Mark Miller wrote:
> On 3/23/07, Mark Miller <erights at gmail.com> wrote:
>> The next message will contain the untested
>> makeMultiChannel.emaker, which requires the new makeProxy mechanism.
>
> Here it is. Shortly, we should find out how foolish I've been ;).

It runs, except that I had to add the line:

   def makeProxy := <import:org.erights.e.elib.ref.makeProxy>

Here's the session, in which it behaves like I expected it to:

? def makeMultiChannel := <import:makeMultiChannel>
# value: <makeMultiChannel>

? def [a, d] := makeMultiChannel()
# value: [<Promise>, <distributor>]

? def r1 := a <- run("1")
# value: <Promise>

? r1
# value: <Promise>

? d.forward(fn x { println(`got $x`); `response to $x` })
got 1

? r1
# value: <Promise>

? r1 <- __whenMoreResolved(println)
# value: <Promise>
response to 1

? d.forward(fn x { println(`got again $x`); `response again to $x` })
got again 1
response again to 1

? a <- ("two")
# value: <Promise>
got two
got again two

-- 
Kevin Reid                            <http://homepage.mac.com/kpreid/>




More information about the e-lang mailing list