Skip to content

About the assignment of private member variables #40523

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

Closed
toop opened this issue Feb 7, 2020 · 4 comments
Closed

About the assignment of private member variables #40523

toop opened this issue Feb 7, 2020 · 4 comments

Comments

@toop
Copy link

toop commented Feb 7, 2020

I very like the Dart lang!
But the assignment of private member variables of the class is restricted to the current file, it's strange. Strongly recommended to restrict it to the current class !!!

@lrhn
Copy link
Member

lrhn commented Feb 7, 2020

Dart currently only has library-private declarations. The idea is that you can trust the current library because you are writing it yourself, and if you want a stricter access, you can create a library with just the one class, then only that class can see its own private variables. As such, it's adequate as a containment mechanism.

We are considering whether there are access patterns with stronger protections that we can allow in some situations, fx in dart-lang/language#757.

@toop
Copy link
Author

toop commented Feb 7, 2020

Thank you very much for your reply! Restrict to the current object, may be are access patterns with stronger protections !!!

@vsmenon
Copy link
Member

vsmenon commented Feb 7, 2020

Thanks for the issue. Closing this in favor of dart-lang/language#757

@vsmenon vsmenon closed this as completed Feb 7, 2020
@toop
Copy link
Author

toop commented Feb 12, 2020

Strongly recommended that assignment of private member variables should be restrict to the current class by default!!! @vsmenon @lrhn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants