Any information for C# post-4.0 would be speculation and rumor at this point. Planning for the next release is in its infancy.
(edit) In addition, the language feature you mentioned is pure rumor.
Any information for C# post-4.0 would be speculation and rumor at this point. Planning for the next release is in its infancy.
(edit) In addition, the language feature you mentioned is pure rumor.
I have heard that there will eventually be a shell, making it even closer to a scripting language. I don't recall the other items, but you can watch toward the end of The Future of C# interview with Anders.
A good resource for musings and speculations about where the C# language is going (and why) is Eric Lippert's Fabulous Adventures in Coding blog. Eric is a senior developer on the Microsoft C# compiler team and a frequent contributor to this site.
Enjoy,
Robert C. Cartaino
I'm hoping for:
fieldof(string.Empty)
(FieldInfo) and methodof(string.ToString)
(MethodInfo) operatorsinitblk
and cpblk
IL instructions in unsafe codeIn C# 5.0 we will see the opening up of the compiler with an API allowing you to call in to create pieces of code at run-time! This is something of the coolest and most powerful C# has gotten added with that I know of. It will take some time still before we see this addition but it will be here soon. I can’t wait! Anders showed you can make strings into runable code – a really powerful scripting engine that is – in the run time and execute them at will. This dynamic code will appear as needed and disappear when used to end. This is so awesome!
http://blog.noop.se/archive/2008/10/28/the-future-of-c-4.0-and-then-5.0.aspx
C# 5.0 Features: Well, the one thing we do know about C# 5.0 is that Microsoft is trying to deliver this concept of "Compiler as a Service". Building on the dynamic concepts of 3.0 and 4.0 this will introduce an "eval" capability.
http://www.matthewlefevre.com/blog/entry.php/c-40-and-c-50/368
In pure, awesome speculation I predict there will be...
Partial function application
some_fun("Hello World", _, 42, _)
as shorthand for
(x, y) => some_fun("Hello World", x, 42, y)
Also works for member access, so you can write
pets.OrderBy(_.Age).Select(_.ToString())
instead of
pets.OrderBy(x => x.Age).Select(x => x.ToString())
I'm hoping they integrate Tuple's and pattern matching like: http://en.wikibooks.org/wiki/Erlang_Programming/Pattern_Matching It would make returning multiple things from a method cleaner. It would make multithreaded calls faster. It would be a non oo way of getting data across.
I'm also hoping for something that will never happen... switch case fall-through.
As others have said, it's all pure speculation at this point. We have not even shipped C# 4.0 yet, and we have not announced that there will be anything past that. Any discussion of hypothetical features of hypothetical future versions should be taken as "for entertainment purposes only" and not as a promise of any particular feature on any particular schedule.
All that said: it is probably best to assume that the hypothetical next version of C# will concentrate more on "tooling" features than "language" features. Many of the language features we would consider doing in the future, many of the IDE features we would consider doing in the future, and many of the IDE extension features that third parties would like to do, all depend upon being able to treat the compiler as an "analysis engine" rather than as a traditional "code generator".
We have only limited budgets here, and so any work we do on improving the tooling infrastructure is work we're not doing on language features.
This is of course not to say that we don't have a LONG wish list of language features. I've hinted on my blog that we are well aware that metaprogramming, asynchronous programming, parallel programming and immutable data programming are all increasingly important in the industry. But those themes are huge and how they translate into specific features is unclear. We understand that there is a lot of work to do in the tools space that adds value to the language, and so it is entirely possible that the hypothetical next release will concentrate more on that.
But again, this is all speculation. We'll see what feedback we get, what the budget situation is like, and so on.
I hope they will add something like the "Elvis Operator" (?:) and "Safe Navigation" (?.) from Groovy. Examples how it could look like:
The Elvis Operator is a more compact way to set a default value instead of using a null-check and the standard ternary operator.
rockstar = rockstar != null ? rockstar : "Elvis Presley";
would become
rockstar = rockstar ?: "Elvis Presley";
The Safe Navigation operator keeps you from writing multiple chained null-checks.
User user = User.find("admin"); // might be null if 'admin' does not exist
String streetName = null;
if (user != null && user.address != null) {
streetName = user.address.street;
}
can be simplified to
User user = User.find("admin"); // might be null if 'admin' does not exist
String streetName = user?.address?.street;
streetName will be null if any one of user, user.address or user.address.street is null. No NullPointerException will be thrown.
I Agree with Claes Mogren. That Safe-Navigation operator is a must!