It's Not Easy Being Green

I spotted a really interesting paper on LtU: Event-Based Programming without Inversion of Control. I've been experimenting some with IoC, but I've noticed exactly the problems the authors noted. IoC, when applied to core program logic, causes that code to get spread across a number of functions. Anonymous delegates in .NET 2.0 do help with this problem - you no longer have to declare an entirely separate function when registering an event handler, and you build lexical closures in this manner. Still, there's a fair amount of syntax around anonymous delegates. They're nowhere near as clean as a block in Ruby, or even a Javascript function or Lisp lambda.

The really interesting part was Scala's threading model. The conventional wisdom is that "green" (non-native) threads (or processes) are a bad thing, mainly from the experience of Java 1.0. I'm not sure that the conventional wisdom holds. I think that the authors' findings would lead one to believe that green threads in the abscence of continuation support at the VM level are a bad thing.

— Gordon Weakliem at permanent link