PDC session abstracts have recently gone live with some new details on the C# language. Some of the other tracks don’t really intrigue me as much. Avalon and Indigo are already in beta, so I don’t expect much to change before release. IE7 needs to play catch up in web standards, and ASP.NET 3.0 is interesting, but I am not very likely to play with it before its release, when hosting providers are available.
It appears that Meijer paper on the bridging of dynamic typing with static typing extrapolates from trends in the C# programming languages rather than indicates any new features in the language.
I gather from the details that C# will include support for querying databases and XML, but this support doesn’t come from domain specific extensions to the language as I initially feared. The database support is primarily from “Integrated Query Framework” (IQF) library, included in the .NET Framework, allowing all .NET languages to benefit and also to avoid aging any of the languages. IQF includes “a strongly typed data access framework and an innovative API for manipulating and querying XML.” To support the IQF, the C# language includes general-purpose extensions such as “extension methods, lambda expressions, type inference, and anonymous types [which] make it possible to create powerful APIs for expressing queries and interacting with objects, XML, and databases in a strongly typed, natural way.” Cyrus Blather also mentions implicit types and expression trees.
Information in the VB abstracts indicate similar capabilities in the language, which “optimized queries over objects, XML, and databases in a consistent way.” More explicitly, IQF enables “developers to express queries and updates in terms of their local programming language without sacrificing the server-side execution model of today's high-performance SQL-based approaches. Using these advances, database queries that previously were stored as opaque strings now benefit from static type checking, CLR metadata, design-time type inference, and of course IntelliSense.
Some of these features have been previously mentioned such as anonymous types (tuples) and type inference/implicit types with the var keyword. It’s obvious that tuples are used to represent table records, and the var keyword is used to avoid the cumbersome task of specifying the lengthy type names of records. These features are already familiar in some functional languages, along with lambda expressions. Lambda expressions would seem to be already available as Whidbey anonymous methods, but the emphasis on expressions in the name indicates that they can’t contain statements and probably have a tight syntax.
Other previously mentioned features are conspicuous in their absence but may actually be fully provided by the library instead of the language. I suspect this to be true for sequences; either that, or the IEnumerable interface suffices for its purposes. Type lifting through generalized member access might also have been redundant, since it can be accomplished via the unified “select” querying model. In COmega, it wasn’t clear to me that the gap between XML and relational data had been bridged as each type was accessed through generalized member access and SQL queries, respectively. Concurrency features are absent, but, then again, the mechanisms in Polyphonic C were unproven. Object initializers, which Anders suggested in place of XML literals and could have enabled DSLs in C#, are also missing in action, as are mixins, which he indicated in a whiteboard talk that the CLR team was investigating.
Some new features have come to light, namely extension methods and expression trees. Extension methods may be a general mechanism to extend the syntax of the C# language to support new domain-specific features such as SQL syntax. Expression trees may be what Erik Meijer referred to as “code literals.” This most likely allows the select and where clauses in the C# extended syntax to accept type-checked query expressions, which could later be converted to the string queries that the database engine understands, thereby eliminating runtime parsing errors and SQL injection attacks. This should be a fascinating concept, possibly enabling C# metaprogramming, so I am interested to see how this is implemented, especially since C# developer, Cyrus, calls it his favorite feature. (It may even pull him away from OCaml. Wow.)
Some other nitpicks of mine: C# 3.0 apparently doesn’t provide any syntax support for transactions, multiple-dispatch methods, covariant return types, default parameters, or generic variance.