FAQ

On Friday, November 29, 2013 5:49:05 PM UTC+5:30, Dmitry Vyukov wrote:
On Fri, Nov 29, 2013 at 4:04 PM, Niket Patel wrote:
If there are more cases, and you don't want to duplicate them, then
you can play with nilling out channels:
http://play.golang.org/p/naIbMzjkp_

Dimitry, I think this should work and idiomatic too. (didn't tried it yet).
still I wish if language supports this case then even if reader doesn't know
nil tricks can understand.
It's impossible to wait for all involved channels to be ready, because
you do not even know values of some channels before some other channel
operations complete (not saying about potential channel operations in
f and g):
case outc <- f(<-c1, <-g(<-c2)):
Supporting and providing special syntax for only:
case outchan <- inchan:
seems inconsistent. There are immediate extensions that one will request
like:
case v1 <- c1, v2 <- c2:
And I am not sure how it all plays with sync channels. Currently the
condition for sync chan operation to proceed involves 2 goroutines on
a single chan. With your proposal, it seems will be able to involve
arbitrary complex graphs of chans and goroutines.

I tried your suggestion, it works and read better except the need to extra
variables nil does the trick.
http://play.golang.org/p/KLqu8V_M4x

Thanks, good explanation behind not supporting multiple channel operation.
I think you will agree that special case is more natural, like joining
pipes.

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

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 11 of 11 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedNov 29, '13 at 11:31a
activeNov 29, '13 at 12:30p
posts11
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase