Justin du Coeur (jducoeur) wrote,
Justin du Coeur

C# 3.0

For programming junkies only: now that C# 2.0 is on the verge of becoming real (in late beta, with real release coming in a couple of months), they're starting to talk brass tacks about the 3.0 version of the language. It's fairly ambitious, although not everything I might wish. Info can be found at the C# Future Versions page.

Major things I notice in the preliminary language spec:
  • They're starting to pick up serious elements of functional programming. (The C language family finally moves into the 1990s.) 2.0 gets anonymous methods; 3.0 gets lambda expressions. They're adding type inference, which is almost audacious for a C-family language, although this version still seems pretty simplistic compared to more serious functional languages. (Actually, I think the main point of the type inference is to simplify the syntax of the lambda expressions, and move a bit closer to higher-order functions.)

  • New, intriguing concept called "extension methods", which allows class A to declare extensions to class B. Not really a true mix-in capability, but an interesting bit of syntactic sugar.

  • Proper object member initializers, fixing a lack that's been conspicuous since 1.0. (They've always had initializers for attributes, but not for real objects; the discrepancy has always struck me as strange.)

  • "Anonymous types", which are essentially strongly-typed property bags -- you initialize an object with a bunch of properties, and a new type is created based on those properties. Similarly, implicitly typed arrays, which infer the array type based on the initialized contents.

  • A Query language, rather similar to SQL, built into the C# language. It's not specifically DB-based, although it's clearly optimized for that. The notion is basically that, if you have a collection that conforms to the queryable interface, you get a bunch of syntactic sugar for managing those queries.
Overall, it's not bad. I like the functional enhancements -- I'll be very curious to see whether they cohere well enough to make C# behave like a higher-order language. The Query language looks potentially interesting, but seems like a half-measure compared to the stuff in Comega; I'm disappointed that they don't seem to be going whole-hog with the streams concept in there.

In sum, I'll look forward to it. (But not as much as to the generics that I'm about to get...)
Tags: programming

  • How I Spent My Birthday

    (Warning: diary ramble ahead.) Intercon was scheduled a couple of weeks earlier than usual this year -- our experimental hotel last year wasn't…

  • Hamilton Sing-Along

    Almost done with a *very* long weekend at Arisia. Generally been a great time -- worked hard, got to spend lots of time with friends, and have had a…

  • Musical Comedy

    The annoying cough I've been dealing with for a week finally turned into a full-on, OMFG, now-I-see-why-everyone's-so-draggy Monster Headcold…

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded