Pure Danger Tech


CodeMash: Mads Torgersen .NET keynote

08 Jan 2009

I arrived at CodeMash a little late (around lunch time today) and managed to have a nice and expensive conversation with an Ohio law officer about my speed on the way to the conference. But anyhow, I got here just in time for lunch (why else was I going so fast?) and Mads Torgersen did the keynote over lunch.

The official title of Mads’ keynote was “One Big Happy Family: Where are the Managed .NET Programming Languages Heading?” and at first glance I saw .NET and my brain turned off because I live in Planet JVM. However, it turned out to be very interesting as it dovetailed quite well with a lot of stuff I’ve been looking at lately as well as my interest in where Java 7 is going. Mads is the Language PM at Microsoft and has had a hand in much of the interesting stuff going on there with C#, LINQ, the DLR, etc.

He talked some at the beginning about how it was interesting that languages that get talked about and taught in academia don’t actually get used (much) in industry. Some examples were Simula (objects), Smalltalk (everythng is an object), Beta (conceptual abstraction), Lisp (code as data), and Self (tangible objects).

Mads also talked about the design forces that language implementors use to decide what features do (or do not) go into a language. He said the number one request they get from customers is to STOP adding features, which is pretty funny. It certainly echoes the sentiment of a strong contigent of Java developers that consistenly lobby against new language features.

The three key trends they’re thinking about in the .NET languages right now are dynamic programming, declarative programming, and concurrent programming. The dynamic part is obviously about supporting more dynamic languages. Declarative refers more to saying what you’re doing instead of how (imperative). LINQ is one example of this and the functional programming in F# is another.

He circled back to concurrency at the end and mentioned that some approaches in the short-term might be more declarative features (I imagine Parallel LINQ would be an example) and possibly even lightweight threads like actors. Longer term he talked about changing how we think from a default of “must occur sequentially” to making “should occur in parallel” the default.

He had a slide about how VB and C# keep trending towards each other and any time one language gets a feature, the users in the other community get upset, so they have changed their policy there and decided to co-evolve those languages as that makes sense to do.

Mads went over a lot of DLR stuff that I wasn’t familiar with that was really helpful, just from an architectural perspective. DLR is implemented as a library over the CLR (something I never was quite sure about). The library provides support for expression trees, dynamic dispatch, and call site caching. Building these in a library is nice because they have built good (library-level) abstractions and that should make it cleaner to start potentially pushing these concepts down into the CLR itself. It also means that they can do this selectively over time as they can always fall back to the library. One question at the end of the talk was about continuation support and the answer suggested that it’s effectively not possible to do in DLR as a library and not easy to do in CLR but is something they are very interested in. John Rose has talked about adding continuation support in the JVM under JSR 292 but seems like that would be well behind invokedynamic and hopefully tail recursion (which the CLR supports directly).

The expression tree thing was interesting as they basically use this for LINQ where a chunk of code, instead of being executed, gets turned into an expression tree (which I assume is an AST) and handed to something to “execute”. That code can then generate whatever logic it wants based on the expression tree. That’s a pretty powerful feature.

Another interesting direction they are headed is to rewrite the C# compiler (currently in C++) into C# itself so that they can then break out useful sub-parts (like a compiler service or REPL) and provide them as services in languages.

This talk did not kind of weave through a lot of topics without much direction, but fortunately it made a lot of interesting stops along the way (for me at least).