|
|
|
|
|
by stevecooperorg
4605 days ago
|
|
C# 4 added serious dynamic typing, so that you can make ruby/pthon/js-style dynamic objects; // properties not declared anywhere; runtime property definitions
dynamic myObject = new JavaScriptStyleObject();
myObject.firstProperty = "hello";
myObject.secondProperty = 1;
C#5 added async/await, which I think is one of the most 'integrated' ways I've seen of doing async programming. Think node.js with a lot less syntactic cruft around the callback functions; in C#5 you could write, say; // evented I/O using the 'await' keyword;
var fileContent = await ReadFile(@"c:\foo.txt");
Console.WriteLine(fileContent);
rather than; fs.readFile('c:\\foo.txt', 'utf8', function (err,data) {
console.log(data);
});
This eliminates the need to write lambdas while retaining the evented I/O style.Both of these seem pretty significant. |
|
C#'s async comes from F#'s async (available since Oct 2007), which in F# is just a library. That's because F# supports workflows aka computation expressions aka warm fuzzy things. What F# does as a library feature, C# requires baking into the compiler.
So for 5 years now, MS has added these two features. They've still yet to deliver a REPL, or finish implementing type inference, or any such stuff. It looks like Anders Hejlsberg, the main C# designer, seems more interested in adding some basic features to JavaScript, lately. C# seems fairly abandoned, language-wise, to me. They seem to be content to have put Java in its place, and leave it at that.
P.S. C#'s a great language, and I'm not trying to insult the people that have done great work on it. As a popular language, it's one of the nicest ones out there IMO.