[Proposal]: Modularization of #[program]
Attribute Macro for Improved Maintainability
#3011
Labels
#[program]
Attribute Macro for Improved Maintainability
#3011
Hello!
I've been using Anchor for quite a while now and found an area of improvement regarding the
#[program]
attribute macro. Currently, all smart contract functions must be defined in a single module, which can become cumbersome for enterprise level programs.I propose enhancing the
#[program]
attribute macro to allow splitting smart contract functions into multiple modules. This would improve maintainability and modularity, making the codebase easier to manage, especially for large projects.Let's consider the example from the readme file:
Instead, we can split these functions into separate modules:
Module 1: init.rs
Module 2: funcs.rs
Combined Modules:
This is just a toy example to easily explain this feature request.
The benefits of such a feature, including but not limited to:
What do you think about this feature? I believe it will be particularly useful for large smart contracts, making them more modular and easier to maintain. Your feedback and thoughts on this proposal would be greatly appreciated.
Best!
The text was updated successfully, but these errors were encountered: