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

Use private instead of fileprivate if possible #444

Open
JakeLin opened this issue Apr 11, 2017 · 1 comment
Open

Use private instead of fileprivate if possible #444

JakeLin opened this issue Apr 11, 2017 · 1 comment

Comments

@JakeLin
Copy link
Member

JakeLin commented Apr 11, 2017

Following up @tbaranes 's comment on #437 (comment)

We should consider using private if possible instead of fileprivate.

Personally, I don't like the idea of having two privates: private and fileprivate. But since we have them, we should follow Principle of least privilege. For example, we should use private for variables and methods if they get used within the same scope (same extension, same class or struct). If we can't, then use fileprivate when those variables and methods get used in different scope but within the same file.

How to do it?

Search all fileprivate and see which one can be downgraded to private.

@phimage
Copy link
Member

phimage commented Apr 15, 2017

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

No branches or pull requests

2 participants