Saturday, October 09, 2004

I love .NET, but it sucks

And here's another thing. I really like coding with .NET, but the thing I like most about it is its promise of multi-language development. Unfortunately, it doesn't deliver! Now I'm not talking about little qualms like the fact that you can't put C# code and VB code in the same project. I'm talking about the incorrect assumptions and lack of vision in the design of the CLR and CTS.

  • They assume you'll only ever want single inheritance.
  • They assume you'll only ever want stack-based control flow, not continuations or coroutines or microthreads or fibers. You can use fibers (cooperatively scheduled threads), but it is not part of .NET; you have to use the Win32 API for threads, but this is not portable to Mono or DotGNU and, I would guess, the Compact Framework; and can't be used in a web browser.
  • They assume you'll only ever want a static type system
  • They didn't give much/any consideration to functional programming methodologies

However, they are improving things somewhat. They have added a useful and efficient system of genericity in .NET 2.0, for example. Dino Viehland of Microsoft told me

“we're certainly aware of coroutines and other forms of non-stack based control”


“we have no specific plans to support fibers as a managed API”


“This is one area that seems to be a bit of a hot topic, so hopefully we'll do something here”

I have written an article extolling the virtues of coroutines (here) and others have written of the advantages of microthreads. I encourage you to learn how these concepts could be useful in your software development, if only it was actually possible to use them!

No comments: