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

Support for effective access control levels #940

Open
SimplyDanny opened this issue May 13, 2024 · 0 comments
Open

Support for effective access control levels #940

SimplyDanny opened this issue May 13, 2024 · 0 comments

Comments

@SimplyDanny
Copy link

The rules for access control levels (ACL) that take effect in Swift (how the compiler determines them) are not always obvious. I'm thinking about questions like:

  • What is the default ACL of a declaration defined in a type or extension?
  • What is the ACL of nested types and their children?
  • Which declarations can be access from other declarations inside of the same file?
  • What can be seen when importing the module that contains the file at hand?
  • ...

I think that effective ACLs can be computed on a syntax-level only. There is no knowledge of compilation options or resolved types needed.

Thinking about visualization: There could be another tab in the editor on the right for ACLs. And then in a drop-down menu one can select "Access from the same file", "Access from the same module" and "Access as an importer" which would result in different highlighting in the editor. In fact, the accessible declaration would be highlighted. On hover, one could see the effective ACL of a declaration. And perhaps also highlight other declarations that are accessible from the current scope (where the cursor is placed).

These are just ideas. There might be better ones ...

What is the general impression about such a feature?

@SimplyDanny SimplyDanny changed the title Support for effective access control level Support for effective access control levels May 13, 2024
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

1 participant