jducoeur: (Default)
[personal profile] jducoeur
One of my co-workers yesterday sent me this link, detailed the upcoming features of C#. I am actually happy with Microsoft for a change, and need to vent.

C# is generally a very nice language. It's basically what Microsoft wanted Java to turn into, except that Sun sued to prevent them from changing the language. So in typical Microsoft style, they changed the name, made the language changes they wanted, and claimed it was all terribly original. The changes between Java and C# are generally good ones (adding things like delegates and properties), but there have still been some real hassles. Hence, I'm very happy about the proposed changes.

First, they're adding generics, thank heaven. Java is also finally getting around to generics, fully fifteen years after the rest of the world figured out that they were necessary. (I can deal with a language that has generics; I can deal with a language that has macros. Having neither makes me feel like I've cut off my left arm when coding, though -- it makes many routine tasks far more of a pain in the butt, and sacrifices type-safety all over the place.) The C# implementation looks quite nice, including interface constraints for templatized classes (something I dearly wish C++ templates had had while I was working on those). They claim that it's going to be much more efficient than Java's version, which is probably true, mostly because Microsoft is apparently willing to cold-bloodedly sacrifice back-compatibility in their virtual machine. (Which they can afford to do, since it's still early days for .NET.)

They're adding a thing they call iterators, which are basically a version of enumerators that don't suck. I very much like the first-class support for enumeration and iteration in C#, but designing classes to use it is a damned nuisance. The new iterator mechanism is much more modern, and should be much easier to code for. And it adds the yield command to the language, which is intriguingly dangerous -- I'm used to yield mostly through Ruby, which lets me do all kinds of powerful things with it. Heh; new toys...

It adds anonymous methods for callbacks -- basically, a reasonable version of lambda functions. About damned well time, too: IIRC, Java has had these for a while now. This should cut down on a fair amount of code bloat, by reducing the number of unnecessary first-class methods.

As for partial types -- a fine thing, which I approve of, but basically pure syntactic sugar. Very, very occasionally useful, but not on the same plane as generics.

Overall, a nice step towards evolving into a genuinely high-level language. Now, the only question is when they're going to actually release this. I'm hoping that, if they're talking about it publically, it's at least half-implemented. In the meantime, I am going to continue to pine for strongly-typed hash tables...

(This message has been brought to you by the Computer Language Addiction Center. Please donate to help poor innocent language geeks like myself become productive, comprehensible members of society...)

Profile

jducoeur: (Default)
jducoeur

June 2025

S M T W T F S
12 34567
891011121314
15161718192021
22232425262728
2930     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags