FAQ
Hello,

I lately found this code snippet in some sample code somewhere on the
Internet:

    val result1 = Future(1)
val result2 = Future(2)
val result3 = Future(4)

val res = for {
r1 <- result1
r2 <- result2
r3 <- result3
} yield (r1 + r2 + r3)

res onSuccess {
case res => println(res)
}
I really like this code as it makes dealing with callbacks so much easier.
Now what I'm dreaming of is being able to replace the futures with
CSP-style channels as in Go. The point of this is that channels are not
"used up" once one item has been supplied as futures. So you can continue
to insert data into a channel as the data is supplied while everything else
stays the same.

My question is now whether anyone has thought about whether this could be
done in Scala, eventually with the use of Akka.

Thanks, Haddock

--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 3 | next ›
Discussion Overview
groupscala-user @
categoriesscala
postedJun 26, '15 at 8:04a
activeJun 27, '15 at 1:42a
posts3
users3
websitescala-lang.org
irc#scala

People

Translate

site design / logo © 2022 Grokbase