C# 7 Work List of Features
(revision circa April 26 2016, clarifying edit June 14, 2016)
This is a list of features are looking at for C# 7, roughly categorized according to our current level of interest and estimated plausibility.
Please don't infer anything about the final shape of C# 7 (or future versions). The list is a tracking mechanism for work, not a description of the outcome. We have a long way to go yet!
Each bucket is in no particular order. I'll try to think of a more systematic way of cross-referencing with proposals and notes, but wanted to get the list out there.
I'll keep the list updated as we look at more feature ideas and change our minds about the relative importance.
Strong interest
- Local functions (Proposal: dotnet/roslyn#259) [currently in future branch]
- Tuples (Proposal: dotnet/roslyn#347)
- Pattern matching, part I (type patterns in switch statements and is-expressions) (subset of Proposal: dotnet/roslyn#206 Pattern Matching)
- Ref locals and ref returns (Proposal: dotnet/roslyn#118)
- replace/original (part of generators) (Proposals: dotnet/roslyn#5292, dotnet/roslyn#5561)
Some interest
- Binary literals (Proposal: dotnet/roslyn#215) [currently in future branch]
- Digit separators (Proposal: dotnet/roslyn#216) [currently in future branch]
- out var (Proposal: dotnet/roslyn#6183)
- Async main (Proposal: dotnet/roslyn#7476)
- address of static method for unsafe interop code (Do we have a proposal?)
Non-language
- Generators (Proposals: dotnet/roslyn#5292, dotnet/roslyn#5561)
See also Language Feature Status (compiler team)
What has happened to variable declaration expressions (which almost made it into C# 6) and the semicolon operator?
Yeah. Declaration expressions was one feature I was really looking forward to in C# 6. I hope they're not dropped for good.
- Supersedes
What does that point mean? Searching for "supersedes" in the issues only returns this one. :)
Is there any possibility that it will be released before the next version of Visual Studio? Waiting for two years to get all those awesome features would make me sad (although I have no idea about the complexity of the work).
PS: TypeScript seems to have lots of minor versions released.
@MadsTorgersen, I updated the description with some more proposal #s.
We should probably separate out from "Safe fixed-size buffers" the ability to use custom types (rather than the small set of primitives allowed today) in fixed-size buffers. That's separate from being able to use fixed-size buffers in safe structs, but we lumped them together when discussing how we probably wouldn't get to "safe fixed-size buffers".
What about the Nothing / DoesNotReturn feature?
Deterministic disposal feature is mentioned both in "Some interest" bucket and "Probably never" bucket (as Destructible types). Having link to same proposal I suppose they both refer to the same thing.
@stepanbenes, I believe what Mads is trying to convey is that the specific solution called out in the proposal is something we don't intend to do as-is, but we would still like to do something to address the same problem area.
The "Strong Interest" list is awesome. Pattern matching will be a huge addition to the language. I'm quite excited about async streams as well but I would hope that there is some room to consider IObservable<T> as well as a new IAsyncEnumerable<T>. I'd be happy to contribute towards that solution.
About static members in an interface, I believe that the CLR already permits that. Unless I'm misinterpreting what the feature entails. You also already have CLR support for enum and delegate generic constraints, but I could understand maybe wanting to lump that up with work to expose many more flavors of generic constraints.
Quite the list when you spell it all out!
I agree with nearly everything in the "Strong Interest" bucket. The "Some Interest" bucket has some good ones but also a few "meh" features listed, IMO, and is missing some good ones.
Off the top of my head:
- Semi-colon operator
- Declaration expressions
- Anonymous iterators (could be implemented with local functions)
- File-scoped namespaces (shameless plug, 20 votes and growing!)
- Better documentation solution (XML is for computers to write, not people- I'm sick of XML doc comments)
Also- I'm surprised readonly locals is in the "Some Interest" bucket. From the comments in the discussions it seems like there's strong interest in this, the only minor point of contention is whether to use let or val. I think this feature is just as useful, if not more useful, than the proposed non-nullability analyzers.
I guess the features that would reduce developer errors most are:
- non-nullable reference types
var! dog = new Dog();
- immutable values
let age = 26;immutable int age = 26;
- immutable types
public immutable sealed class Dog { ... }
- contracts
[Requires(...)][Ensures(...)]requires ...,ensures ...
- units (C# 8? syntax?)
@MovGP0 In my experience in enterprise web dev the predominant majority of errors are made outside of C# code - JavaScript, HTML, CSS, SQL. I wish Spartan would just support C# and some lighter XAML natively... So I guess it makes sense to focus on the features that improve language expressiveness instead.
Your strong interest list makes me very happy.
@seanfreiburg How would that differ from the ??-operator?
Any thoughts on dotnet/roslyn#13 (Anonymous types that implement interfaces)?
Also, I think there would need to be a lot of thought given to declaration expressions before they should be "bucketed". The scoping issues from last time will need a lot of discussion. Personally, I still don't like any of the options there (especially the proposal to remove the shadowing restriction)
@dsaf well, yes and no. you are probably right that in other languages, developers make even more errors. still, F# developers make even less errors than C# developers. so it makes sense to make C# more like F#.
besides, XAML/C# in the browser was tried with Silverlight, but sadly unsuccessful. I bet the best chances are to use C#/F# to JavaScript compilers with HTML in the frontend.
I want To have the feature providing the runtime object defination will be changed. This will help of allowing the heavy objects of class. For e.g. if we do not need all the properties at a moment, we will use one rquired object of properties and no need to define separate classes and inheritance.
is it possible??.
If possible plz introduce such a feature. it will be great memory saving.
@dsaf https://github.com/dotnet/roslyn/issues/2136#issuecomment-95434384:
besides, XAML/C# in the browser was tried with Silverlight, but sadly unsuccessful. I bet the best chances are to use C#/F# to JavaScript compilers with HTML in the frontend.
Ditto! Unfortunately it doesn't look like MS is going to open their eyes about this any time soon. With Apache Cordova and the like, this makes the whole even more attractive, having C# and XAML be the ultimate pair for Windows desktop, store, Android, OS X, iOS, and web. Of all UI solutions XAML is the best. HTML-CSS-JS is a pain the ass, pardon my french. There are many solutions about this out there, nothing free, nothing out-the-box.
What about support for auto generated object composition
Sad to see declaration expressions and especially params IEnumerable go. Is there anything that was dropped in the last couple of months and where can I read about it? I checked the status page - https://roslyn.codeplex.com/wikipage?title=Language%20Feature%20Status&referringTitle=Documentation but it seems like features that were dropped were removed from the table instead of marked as dropped.