Archive for July, 2010

Prototyping Go’s Select and Beyond …

July 24, 2010

Hi Folks:

On Monday July 19th, I gave the talk “Prototyping Go’s Select in stackless.py for Stackless Python” as a part of EuroPython 2010. It was my pleasure to be invited to speak. Moreover it was great to see Christian Tismer receive an award for his contributions to the Python community.

This final version of the talk is sufficiently different from the original dry run. In large part this is due to Kevin BuluĊĦek’s amazing efforts in implementing a Stackless Python version of select – this expanded the talk’s size. I also wanted to better emphasize the power of prototyping of Python in Python. Finally I wanted to better articulate the differences between Stackless Python and Go’s concurrency models. How could two languages sharing a common ancestor (Limbo) and a very similar API and object model be so different?

Regardless of if one is a newbie curious about Stacklss or a seasoned Stackless Python developer, I feel there is something for everyone in “Prototyping Select.” I also can’t stress enough the fun in preparing the material for this talk. As for the reliance on the Rob Pike’s Newsqueak paper and Plan9’s libthread.c. Well imitation is the sincerest form of flattery…..”

Here is link to the revised slides of Prototyping Go’s Select with stackless.py for Stackless Python and the original. Soon I will place examples and a new version of stackless.py and a Stackless Python patch in the Google repository. Since there are many things said during the talk that didn’t make it into the slides, I will try to write a paper within the next two weeks.

Beyond

As I stated in the talk, neither the stackless.py or the C code are ready for prime time. I am writing new tests and debugging. Hopefully the PyPy and Stackless Python communities will tell me the proper way to introduce the new code so others can learn, use and improve it.

What’s next? Well I attended the PyPy sprint. Took the first baby steps towards learning how to implement select as a language statement. This is what it looks like:

compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | select_stmt
select_stmt: 'select' ':' select_suite

def test_select(self):
        input = """select:
                          case a:
                                  pass
                          case b:
                                  pass
                """
        tree = self.parse(input)

        import pdb;pdb.set_trace()

Thanks Antonio and Armin! I will also soon start experimenting with implementing join patterns and event pattern matching. So stay tuned!

Cheers,
Andrew