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

Consider moving "private" functions to a PrivateImpl #994

Open
andrew-fleming opened this issue May 22, 2024 · 0 comments
Open

Consider moving "private" functions to a PrivateImpl #994

andrew-fleming opened this issue May 22, 2024 · 0 comments

Comments

@andrew-fleming
Copy link
Collaborator

For functions meant to be private, it might make sense to move them out of a component's InternalImpl and into a PrivateImpl. I think this will better communicate that the moved functions are meant to be private. Here's an example of this idea: https://github.com/andrew-fleming/cairo-contracts/blob/ffe01ad9949e4e10ed21df69041bbeb673c404ba/src/token/erc721/extensions/erc721_enumerable/erc721_enumerable.cairo#L128-L136

Furthermore, this separation makes it more difficult to accidentally misuse sensitive functions. Most contracts bring a component's InternalImpl into scope to call the initializer which means that private functions are also immediately accessible

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