513 karma · joined April 13, 2015
... yes, if there is any capacity left. Capacity for the new process is a limited resource after all.
Thank you.
err := close(ch)
to handle case when you don't want a panic on closing of closed channel. The first one was discussed on golang-nuts, but it died there.1. I would politely disagree with Go channels are efficient. If they would be efficient, they would be actively used internally as a synchronization primitive. I don't remember seeing external libraries using it past notification mechanism of "it is done" kind either. There would be some nifty tricks possible if cost of channels is much lower, or compiler would be able to use some "very light" channels if it sees it is possible (not sure if it even theoretically possible, but I am not an CS theory guru...)
2. That's kind of unfortunate, I would prefer if error is requested, just return an error
err := ch <- data_to_send
vs ch <- data_to_send
which might panic. But looks like neither of languages allow this. I proposed the syntax above to Go, but it was rejected.3. That's nice. Is there an error to catch if needed?
err := close(ch)Btw, there is another saga (drama?) unfolding on github proposal discussions over sum types [2], and judging by the past experience I don't have high hopes for it to get into the language.
[1] https://github.com/golang/go/issues/33502
[2] just one last I saw today, but there are more tickets about same or connected issue https://github.com/golang/go/issues/41716
1. Will they be as heavy as Go's ? Go has 2 mutexes and some other fluff
2. Are they "close-safe" like, if I send something to the channel, and it is nil or closed, will it panic crash or stuck forever like Go does, or V is trying to be "panic-free"? Will "prohibited" operation return an error or panic/stuck?
3. If channels are closeable, will I be able to close them twice without panic (closing closed door might creak, but IMHO should not burn the house down...)
(At some point in the past I did suggest adding an error to channel operations so it will not panic if I am ready to intercept an error, but that was rejected)I will see myself out.
I can see this as the reason why Twitter does not delete presidential twits - they don't want to break the law.
Our experience was about the same - both cost- and perf-wise. It just that our perf boost number was order of magnitude bigger on some tasks :).
- Why did you move to Postgres?
- What was perf impact/improvement after moving to Postgres?
Thank you in advance!It is hard to hide an age :)