Open andrew-fleming opened 1 month ago
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
InternalImpl
PrivateImpl
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
initializer
For functions meant to be private, it might make sense to move them out of a component's
InternalImpl
and into aPrivateImpl
. 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-L136Furthermore, this separation makes it more difficult to accidentally misuse sensitive functions. Most contracts bring a component's
InternalImpl
into scope to call theinitializer
which means that private functions are also immediately accessible