[Stackless] Google's new Go programming language
richard.m.tew at gmail.com
Sun Nov 15 19:49:49 CET 2009
On Mon, Nov 16, 2009 at 5:13 AM, Andrew Dalke <dalke at dalkescientific.com> wrote:
> On Nov 12, 2009, at 9:40 PM, Andrew Francis wrote:
>> That said, one feature that would be nice to have in Stackless as a
>> language feature would be select, where one is waiting on multiple channels.
>> Yes this could be built as library but it is not as nice.
> Is this clean? Elegant? A hack? I don't recall people bringing up the need
> for something like it before.
Yes, that I could not recall anybody with a need for it, was what
crossed my mind.
I pictured it having an interface like:
selected_channel = select(quit_channel, request_channel)
if selected_channel is quit_channel:
elif selected_channel is request_channel:
We could accomplish this by making channel subclasses perhaps that
allow something like 'select' to intercept operations. But I think
your solution is more practical, as thinking about this, it is not the
case that channels are the only primitive that are dealt with.
Regarding use cases, in theory, given that tasklets concentrate on
specific functionality because the blocking they do relates to an
isolated action, it might be argued that an operator like this would
allow more readable code as handling of separate blocking actions
could be distilled into one function/tasklet.
But again, I cannot think of any use cases offhand that would benefit
from it. As it stands, I see Stackless being a basic framework of
low-level functionality. Solutions like 'select' are perhaps better
coded to address actual needs in custom frameworks built on the
low-level framework that is Stackless.
More information about the Stackless