C# and VB Compilers Being Rewritten in Themselves; “Immutable” attribute coming?

Darryl Taft interviews Luca Bolognese, Group Program Manager for languages at MS, and comes up with some interesting hints.

The lede revolves around MS’ plans to make the compilers more “open” (as in an open can of beer) by providing a “compiler-as-a-service” facility. On face value, “compiler-as-a-service” doesn’t make much sense — compilers aren’t large and I don’t perceive parallel make of C# programs being a grave problem. It’d be lovely to have Visual Studio in the cloud, though…

Apparently they’re rewriting the C# and VB compilers in themselves, which is interesting, if for no other reason than the performance characteristics coming out of the managed side of things.

The buried lede revolves around concurrency and code words like “declarative” and “immutability.”  The hint is that Microsoft sees some big wins coming from the low-hanging fruit of declaring that a variable is single-assignment. (If you know that a variable doesn’t change its value over time, you can use it’s value in different threads without worry.)

What’s interesting about this is not that single-assignment has some advantage (we knew that), it’s the hint that Microsoft sees enough advantage to mention it as a specific optimization. It’s not obvious (to me) that such an attribute would have profound effects in the real world, in that a real application would have a mix of mutable and immutable variables with complex dependencies. So to get a meaningful speedup presumably requires some far-from-trivial reasoning at compile and/or runtime.

div>