Dataflow concurrency instead of generators

David-Sarah Hopwood david-sarah at
Sat May 16 17:50:26 PDT 2009

Jason Orendorff wrote:
> On Thu, May 14, 2009 at 7:35 PM, David-Sarah Hopwood
> <david-sarah at> wrote:
>>> For instance, suppose that you have dataflow concurrency, as supported
>>> by Oz and by recent dataflow extensions for Ruby, Python, and Scala:
>>> <>
>>> <>
>>> <>
>>> <>
>>> Then the functionality of a generator can be implemented using a
>>> process/thread that extends a list or queue constructed from
>>> dataflow variables.
> I think you are proposing a model in which threads cannot share
> mutable state and cannot have side effects which other threads can
> see.

No. Even in a pure dataflow model, binding a dataflow variable
causes a side effect that other threads can see, if they have access
to that variable.

A pure dataflow model is sufficient to simulate generators, but as
you point out, it doesn't suport some of the things you might want to
do from a generator (or from other code). What I would like to propose
for Harmony is a dataflow + asynchronous message passing model.

> Even the simplest generator use cases can't be implemented using
> threads and dataflow variables in that kind of model.

The use case you've identified requires message passing in addition
to dataflow variables, and it ideally requires the message passing
to have a particular semantics that maximises compatibility with
existing JavaScript. Actually this is needed to support the call to
a DOM object in your example, rather than to support generators.
But you are right that dataflow concurrency is probably not
sufficient on its own if we want to make Harmony a practical
concurrent language.

Bear in mind, though, that adding message passing significantly
increases the expressiveness of the language, so we should take that
into account when comparing the complexity of (lambdas + generators)
with that of (lambdas + dataflow concurrency + message passing).
The latter is much more powerful.

I'll describe the details of what I'm proposing, and how it applies
to your example (which does work in this model), in a separate
message, with subject "Dataflow concurrency and message passing
for Harmony".

David-Sarah Hopwood ⚥

More information about the es-discuss mailing list