-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Champion "Pattern Matching" (16.3, Core 3) #45
Comments
Sad to see this slip, yet again, from 7.1 to post 7.2. Please can we have it soon. |
@alrz You have very nice, simple and powerful proposal in Roslyn repository. |
didn't see that coming. http://cr.openjdk.java.net/~briangoetz/amber/pattern-match.html |
Since I can see the implementation of the other 80% of pattern matching in C# slipping out to beyond v8 (due to the team being so focused on "improving" interfaces at the moment), it wouldn't surprise me if Java gets this stuff before C# does. 😞 |
I did. Java 8 made it a warning to use The C# team could push proper pattern matching out to C# 11 and they'd still likely beat Java to the punch. But I expect that the C# team can actually work through interfaces and patterns at the same time, especially since a lot of the groundwork for the latter has been laid and a lot of the work of the former relies on an external team. It'll be interesting to see where Java goes with the open questions, particularly since they recognize the same scoping issues that the C# team had to work through. |
Thank god they do not do fallback-binding thingy. I wonder why C# is reluctant to take such changes. var should've been a keyword by now. I'd prefer warning-waves cripple my build rather than being another compiler flag. That's another example of how C# deals with these changes in a non-breaking way and it does no good for the remaining +80% of users who do not suck. |
I have now stuck a postit note to my monitor that says, in big bold letters, "STOP MOANING ABOUT INTERFACES; YOU ARE BORING EVERYONE". Let's see if I can follow its advice... |
@alrz The other 20% users probably account for 80% of MSFT's DevDiv revenue. |
@orthoxerox C++ also did this for |
It's not the first time that Java has broken compatibility. When Java adds a keyword it's not done contextually. It's pretty rare when it happens. I think the last time was Java 5 and Java 9 will be an interesting experiment. They've been pretty open that this release will potentially break a lot of code, for two major reasons. First, modules, which finally bring a degree of non-visibility to public/protected members, even through reflection. Second, they're finally going to finally remove a bunch of APIs that have been marked deprecated for a very long time. The removal of If the pain proves to be too much I could see Oracle pulling their punches going forward, perhaps even regressing a bit in a point release. |
A prototype of the latest pattern-matching stuff is available at https://github.com/dotnet/csharplang/wiki/vNext-Preview |
I looked for quite some time where to comment and landed here. Related to this: https://github.com/dotnet/csharplang/blob/master/proposals/patterns.md Which I believe is related to "Recursive Pattern" in this msdn blog post about C#8: https://blogs.msdn.microsoft.com/dotnet/2018/11/12/building-c-8-0/ Which shows the following example:
Wouldn't it be much more concise to allow:
and even:
In both cases, only People of type Student with property Graduated == false should be selected. In the first example, Name should also not be null. In the first example, Name should be assigned to a string variable It should be possible to combine as follows:
|
As you're suggesting new syntax I would suggest opening a new issue. |
@HaloFour , https://github.com/dotnet/csharplang/blob/master/proposals/patterns.md is a 404. As it stands, it's not really clear what syntax this issue is tracking. There's a trail of public and LDM discussion history but they mention different parts of things related to pattern matching. It's just not clear what the current idea is. |
It's moved to https://github.com/dotnet/csharplang/tree/master/proposals/csharp-8.0 as the feature is marked for the release. |
Update: We take this to represent recursive patterns and match expressions. Active patterns should be tracked separately, as they won't happen at the same time.
LDM notes:
or
, pure null tests)The text was updated successfully, but these errors were encountered: