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

Create a DeclProtocol protocol for generically operating on declarations #10

Open
stackotter opened this issue Oct 10, 2023 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest

Comments

@stackotter
Copy link
Owner

At the moment there is nothing shared between the toolkit's declaration wrappers; StructDecl, EnumDecl, VariableDecl, and maybe others by the time someone gets to this issue. A protocol would enable much more powerful generic programming to enable developers to create more flexible macros. Here's a rough idea of what such a protocol might look like (pretty simple for now);

public protocol DeclProtocol {
    var identifier: String { get }
    var accessLevel: AccessLevel? { get }
}

public enum AccessLevel {
    case public
    case private
    case internal
}

Once you've created the protocol, make sure to update existing declaration wrappers (including Decl) to conform to the protocol. Additionally, if DeclGroupProtocol exists by the time that someone is tackling this issue, it should be updated to inherit from DeclProtocol as well.

@stackotter stackotter added hacktoberfest enhancement New feature or request good first issue Good for newcomers labels Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest
Projects
None yet
Development

No branches or pull requests

1 participant