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

Allow user defined setter or getting to overwrite default setter or getter #6113

Closed
DartBot opened this issue Oct 21, 2012 · 5 comments
Closed
Assignees
Labels
area-language New language issues should be filed at https://github.com/dart-lang/language closed-not-planned Closed as we don't intend to take action on the reported issue P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug

Comments

@DartBot
Copy link

DartBot commented Oct 21, 2012

This issue was originally filed by chiaha...@gmail.com


I find it a little bit annoying that i have to make a variable in a class private (or at least a different name), before declaring setter and getters for it. It would be nice if a user defined setter or getter would overwrite the default one. Eg:

class Foo {
  var a;

  set a(val) { //this should overwrite the default setter for a.
    if (val < 0) val = 0;
    a = val;
  }
}

@sethladd
Copy link
Contributor

Removed Type-Defect label.
Added Type-Enhancement, Area-Language, Triaged labels.
Changed the title to: "Allow user defined setter or getting to overwrite default setter or getter".

@gbracha
Copy link
Contributor

gbracha commented Nov 7, 2012

Set owner to @gbracha.
Added this to the Later milestone.
Added Accepted label.

@kasperl
Copy link

kasperl commented Jul 10, 2014

Removed this from the Later milestone.
Added Oldschool-Milestone-Later label.

@kasperl
Copy link

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-Later label.

@DartBot DartBot added Type-Enhancement area-language New language issues should be filed at https://github.com/dart-lang/language labels Aug 4, 2014
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug and removed accepted labels Feb 29, 2016
@munificent
Copy link
Member

I find the verbosity of field-backed getter/setters annoying too.

However, we don't think shadowing a field with the same name is the right approach. My impression is that it adds more complexity than is worth taking on in order to get a little brevity.

@munificent munificent added the closed-not-planned Closed as we don't intend to take action on the reported issue label Dec 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language New language issues should be filed at https://github.com/dart-lang/language closed-not-planned Closed as we don't intend to take action on the reported issue P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

6 participants