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

Champion: "Allow Obsolete attribute on getters and setters" #2152

Open
gafter opened this issue Jan 17, 2019 · 5 comments

Comments

@gafter
Copy link
Member

commented Jan 17, 2019

  • Proposal added
  • Discussed in LDM 2019-02-27
  • Decision in LDM
  • Finalized (done, rejected, inactive)
  • Spec'ed

See dotnet/roslyn#32472
See dotnet/roslyn#32571

LDM history:

@gafter gafter self-assigned this Jan 17, 2019

@YairHalberstadt

This comment has been minimized.

Copy link
Contributor

commented Jan 17, 2019

It would have to be decided whether it would be an error to obsolete all the accessors in a property, as the property should be obsoleted instead.

I would suggest for consistency the design should follow that of VB which already allows the obsolete attribute on getters and setters.

VB allows all accessors ina property to be declared obsolete. It also allows usages of nameof on a property where all accessors have been declared obsolete.

This also avoids needing to special case the obsolete attribute, as any other attribute which is valid on both methods and properties can be applied to all accessors of a property at once.

@scalablecory

This comment has been minimized.

Copy link
Member

commented Jan 26, 2019

I found myself wishing for this just a few weeks ago, when trying to clean up some code that used a bunch of get/set properties to one that was a more read-only ctor-initialized record.

@YairHalberstadt

This comment has been minimized.

Copy link
Contributor

commented Mar 11, 2019

https://github.com/dotnet/csharplang/blob/master/meetings/2019/LDM-2019-02-27.md

It looks like the LDC has supported this proposal.

A prototype exists at dotnet/roslyn#32571

@YairHalberstadt

This comment has been minimized.

Copy link
Contributor

commented Mar 13, 2019

I think that obsolete should be disallowed on event accessors since it is meaningless to make add but not remove (or the other way round) obsolete.

@jcouv

This comment has been minimized.

Copy link
Member

commented Apr 2, 2019

Merged the feature for dev16.1 preview2 (dotnet/roslyn#32571). Thanks @YairHalberstadt!

@gafter gafter moved this from TRIAGE NEEDED to 9.0 Candidate in Language Version Planning Apr 13, 2019

@gafter gafter moved this from 9.0 Candidate to 8.0 Candidate in Language Version Planning Apr 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.