There have been some talks suggesting Microsoft to stop developing C# and simply move on to a new shiny language based on a reason that C# is becoming more complex and its development is approach a diminishing return.

 

Bleh.

 

I can agree with the sentiment but I think it's a bad idea to stop development for C# at this point because there's a couple of more features that can be added to C# 4.0 that will make it "oh, the greatest programming language of all". People always complain for complexity and only need 20% of the language most of the time; except that everybody uses different 20% of all available facilities in a language. I use IronPython extensively but I use only function, array, hash and tuples most of the time - I haven't defined a Python class for a long long time.

 

1. Add Design by Contract.

I don't know why this hasn't  been implemented yet. Implementing Design by Contract eliminates the need to write a kazillion of stupid kind of Unit Tests and have Unit Tests frameworks to access the meta information made available by DBC to verify the code automatically. Go check Spec# to see what I'm talking about.

2. Add Facility for  Macro support.

C# 3.0 already has Expression Trees and right now people only use it to support creating LINQ provider. I think Anders is preparing some new nemerle Macro facilities to make it easier to do meta programming. I bet you  a gallon of beer on this. There's little sense to present Expression Trees if they just stop here. Why would you have an ability to treat Code as Data and not use it to enable Macro?

3. Introduce Fine Grain Immutability construct - side effect free medicine.

We are already moving to Functional style programming with all the LINQ facilities and stuff, it's time to make one of the core idea of functional programming to be included in the language, immutable data structures. Check out Eric's trial balloon on the idea of new fine grain immutability support or Joe's immutability posts.

4. Instant Data Type

Yeah, I know we are all craving for multiple function return values using anonymous class.  Why not introduce some facility to make the local anonymous type to namespace level, pretty much C# capable of declaring JSON style class definition.

public static var ReturnSomething()
{
   return new { FirstName = "Hello", LastName = "World"};
}

named public InstantType returnVal = ReturnSomething()
.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }

This way it solves the problem of C# inability to handle heterogeneous data type (other than using casting all over or long generic statement)  - I would kill for a Tuple support but that's less likely.

5. Mixin would be great, maybe Traits too.

6. Add Duck Typing please.

7. Pattern matching.

 

The goal of above features are:

  • Increase software safety by making programmers intent verifiable by compiler.
  • DSL
  • Less typing.
  • Add new ways to do software composition.

 

That's all :)