-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add a hint @nonVirtual
for class members
#34378
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
Comments
@nonVirtual
for class members@nonVirtual
for class members
I do like it, would be definitely helpful in many APIs. Why not call it |
I believe that is a reserved word/keyword in Dart. It could be (I don't care about the name, to be clear, it can be whatever folks agree on) |
An alternative is just to support /cc @srawlins |
I keep getting into situations where I'd like to have this functionality. For reference, an old school issue from @danrubel asking for language-level support of this is here: #3928. I'll update that issue to link here. I do think it's better (and more practical) to implement this via |
Also just ran into a situation where this would be useful. Any updates on the priority? I'm willing to contribute the change, just not sure where to begin. |
It's now October 2019, and this issue's been open for over a year. can someone on the Dart team let us know what they think about this? |
I'm all for revisiting this. Specifically, it could potentially be used to disallow overriding |
OK, running w/ |
See: #34378 Change-Id: Ie61b8bddaef01cdbf47da9a8ca6915cbd86b21a7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122701 Commit-Queue: Phil Quitslund <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
see: #34378 Change-Id: I0fe67c56bf7c08f211b6bf89d84c5495e32601a7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122742 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Phil Quitslund <[email protected]>
Implemented in server and landed in package:meta: Looking forward to seeing how folks take advantage! |
... or, to help developers when defining the intended use of a class, and to help users use a class properly (i.e. as intended by the class). I'd find this extremely useful when working on fairly complex classes with lots and lots of member fields and methods.
Similar to the spirit of
@sealed
(#27372):General concept:
@nonVirtual
is overriden.Because of how this annotation would need to work, I imagine it would also need to:
Issue a hint when a class with one or more
@nonVirtual
members is implemented (implements
- notextends
/with
), as by definition a class with@nonVirtual
member requires the original implementation:Issue a hint when an abstract member is annotated with
@nonVirtual
. Also impossible:/cc @davidmorgan @srawlins for thoughts.
The text was updated successfully, but these errors were encountered: