There is a select statement.
http://golang.org/doc/go_spec.html#Select_statements
The presence of mobile channels certainly shows the influence of pi-calculus, yes.
On Nov 11, 2009 1:23 PM, "BarryNorton" <barry...@gmail.com> wrote:
Nigel, thanks. I missed it under statements and thought that
'communication operators' was it.
Still, the question stands, does channel-passing not make this a more
pi-calculus like setting?
On Nov 11, 8:17 am, Nigel Tao <nigel.tao.gn...@gmail.com> wrote:
> 2009/11/12 BarryNorton <barrynor...@gmail.com>:
> > > > > I'm struggling to understand why Go is described as inheriting from > > CSP when, in the a...
To keep things simple. nil channels are never selected, so setting the
channel to nil is similar to a guard.
AGL
It tends to work out.
Say you have a goroutine which loops around a select and you want to
do flow control. After the select, if you have too much information
processed, you set the channel that you're reading from to be nil.
select will stop reading from it. Later, when the backlog clears, you
can set it back to it's previous value and start reading again.
AGL
Nothing changed, because Go didn't start with Occam.
The concurrency primitives are closer to Newsqueak
http://www.google.com/search?q=newsqueak
Russ
It was certainly not my intent to be patronising and I'm sorry that
it sounded that way. My point was that CSP doesn't necessarily
equal Occam, and that starting with a different lineage is the
actual explanation of why Go makes different choices than Occam.
I know you mentioned Newsqueak in your original post but
I left the URL for others who were reading along. And I used
the Google search URL because the two papers I actually
wanted to link to are the first two hits.
> I don't mean what changed in a direct design lineage, rather is there
> some change that's made this generally acknowledged difficulty in
> implementing process algebraic external choices, in the presence of
> data, feasible at scale?
I think the answer to that question depends a lot on your model of
parallelism and how shared you think the operations will be.
I think the general plan for Go is to provide the full functionality but
allow the easy cases to be implemented more efficiently than the hard ones.
For example, a sufficiently buffered channel might perform better than
an unbuffered one when it can decouple the communication from
strict synchronization, but sometimes strict synchronization is exactly
what you want, so an unbuffered channel might be just right.
And once you're selecting on unbuffered receives, you might
as well be able to select on unbuffered sends: those two are
approximately the same cost.
Russ
> Also on the subject of "select"
...
> The select statement does not allow guards. Why?
I'm not sure that we've seen a need for them. Sorry to be dense, but
can you give an example of there they would be useful? Thanks.
Ian
occam did this because channels could map directly
to hardware communication channels and it's hard
to do bi-directional alt across processors.
i don't think go has that goal. although perhaps
unidirectional channels could make it possible
in some way - you could maybe privilege select statements which
select on all read-only channels (he says, hand waving horribly)\