[Stackless] Google's new Go programming language

Andrew Francis andrewfr_ice at yahoo.com
Tue Nov 17 21:31:01 CET 2009


Hi Kristján:

--- On Tue, 11/17/09, Kristján Valur Jónsson <kristjan at ccpgames.com> wrote:

> First off, I don't understand what select does in go,
>but I assume some conceptual similarity to unix select()

Select in Go allows a coroutine to wait on multiple channels (in Limbo,
I believe it is called alt, as in CSP). When a channel becomes active, 
it executes associated code. I believe a Go style select would 
simplify writing event handlers. 

some pseudo code to get the flavour what select does 

select:
    ready(userRequestChannel.receive()):
       tasklet(....)()

    ready(administrationRequestchannel.receive()):
       tasklet(.....)()

    ready(diagnosticsRequestChannel.receive()):
       tasklet(.....)()
 

> One thing I'd like to point out is that the select() model

...


> I believe that unix meanwhile has some similar way to avoid
> the scalability problems of select.

Yes UNIX select is bad. I think people use it for portability.
Otherwise on a UNIX system, a better choice would be EPOLL.

> Not having select() helps guide the stackless programmer
> around a bad pattern.

Although this is a different discussion, but I don't think that 
most Stackless programmers see select(), since they are using some higher
level library.

Cheers,
Andrew



      




More information about the Stackless mailing list