Skip to content
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

C#: Allow ref this #3958

Closed
BillWagner opened this issue Dec 15, 2017 · 6 comments
Closed

C#: Allow ref this #3958

BillWagner opened this issue Dec 15, 2017 · 6 comments
Labels
blocked Blocked for some reason dotnet-csharp/svc

Comments

@BillWagner
Copy link
Member

BillWagner commented Dec 15, 2017

There are two related features that will affect the same documents:

  1. Allow ref this (where only this ref is allowed in 7.2) See Discussion: ref this vs this ref in ref extension methods (15.6, as a 7.2 bug fix) csharplang#1022
  2. Relax ordering on ref and partial modifiers. See Champion: relax ordering constraints around ref and partial modifiers on type declarations csharplang#946

The first fixes a grammar issue with ref. Extension methods whose first argument is a struct type currently have to write that argument as ref this T. That looks clumsy and gives the wrong impression upon reading it.

This work would allow this ref T as the preferred syntax.

The second would relax the ordering constraint on partial ref struct.

Neither would not introduce new articles, but would update the grammar for extension methods, argument modifiers, and ref value types.

@BillWagner
Copy link
Member Author

Question for @jcouv Will either of these be targetting LangVersion=7.2 once they ship?

@JRAlexander JRAlexander added the waiting-on-feedback Waiting for feedback from SMEs before they can be merged label Dec 15, 2017
@jcouv
Copy link
Member

jcouv commented Dec 15, 2017

Only the first one (order of ref and this modifiers in ref extensions) will target C# 7.2.
The second one (order of ref and partial in type declarations) would be tied to C# 7.3.

There is also the by-val vs. in tiebreaker that will be targeting C# 7.2.

@BillWagner BillWagner removed the waiting-on-feedback Waiting for feedback from SMEs before they can be merged label Dec 15, 2017
@BillWagner
Copy link
Member Author

Thanks @jcouv The tiebreaker feature is issue #3949 for docs.

@mairaw mairaw added this to the 2018 - Quarter 1 milestone Dec 18, 2017
@BillWagner BillWagner added the P1 label Mar 13, 2018
@BillWagner
Copy link
Member Author

This is being done in a community PR dotnet/roslyn#23533

@mairaw mairaw modified the milestones: 2018 - Quarter 1, 2018 - Quarter 2 Apr 2, 2018
@mairaw mairaw added the blocked Blocked for some reason label Apr 2, 2018
@BillWagner BillWagner modified the milestones: 2018 - Quarter 2, Backlog May 8, 2018
@BillWagner BillWagner changed the title C# 7.3: Allow ref this C#: Allow ref this May 8, 2018
@BillWagner
Copy link
Member Author

Changing the title as this did not make the 7.3 release

@BillWagner
Copy link
Member Author

Closing pending acceptance of the feature.

@mairaw mairaw removed this from the Backlog milestone Oct 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked for some reason dotnet-csharp/svc
Projects
None yet
Development

No branches or pull requests

4 participants