PDC 2008: The Future of C#

(Presenter: Anders Hejlsberg)

What they said:

In this talk Microsoft Technical fellow and C# Chief Architect Anders Hejlsberg outlines the future of C#. He describes the many forces that influence and shape the future of programming languages and explain how they fit into C#.

What I said:

In the last 10 years C# has expanded the capabilities of managed code with features such as generics and LINQ. Another revolution is coming in C# 4.0 to seamlessly interact with dynamically typed objects- essentially any environment that doesn't work on statically declared C# types. The future of programming is to allow developers to work at a higher level together with a runtime that is smarter at translating and executing programs efficiently. Developers are succeeding today with both static and dynamic languages, and C# will grow in the future to absorb the best features from both. This requires advancing the capabilities of C# in the areas of declarative programming, dynamic language integration, and concurrent execution.

Anders goes through an introduction to how C# and the CLR take advantage of the capabilities of the Dynamic Language Runtime for implementation and binding of language features to environments that don't assume the static C# type system. Today, integration with dynamically typed objects requires specially-crafted incantations for interacting with each environment. CLR 4.0 allows unification of the different ways of interacting with dynamically typed objects in the same way that the CLR 1.0 allowed unification of different ways of interacting with statically typed objects. Dynamic types, declared by statically typing an object as "dynamic", defer the selection of members to runtime. This is done in an extensible way through the IDynamicObject interface for language implementers.

Optional parameters and named parameters from VB as well as other syntax simplifications make calling COM objects as natural an experience as calling managed objects. Finally, generic types allow for decorating the class definition with in and out annotations to permit safe casting of types in covariant and contravariant fashions.

The key features coming in C# 4.0 are the integration with dynamically typed objects, optional and named parameters, improvements in COM interoperability, and covariance/contravariance of generic types. Further out are better ways to meta-program: building applications that write and compile code on the fly through deep integration with the C# compiler. These features raise the level of abstraction in programming languages and allow for the developer to focus on saying what they want to do while the runtime optimizes the low-level expression of the application.