demergent-labs/cdk_framework

Modularize generated lib.rs

lastmjs opened this issue · 0 comments

Description
There are two motivations for this ticket:

The generated lib.rs file is getting rather big and unweildy. The code can logically be broken down into modules and so it makes sense to do that. It would lead to a more readable/navigatable file.
We still have the possibility of name collisions because of the way JS/Python imports work. For example, if a developer imports the managementCanister, they also get all the types/structs/enums that it uses behind the scenes in Rust, whether they use them or not. We can likely prevent this problem by embracing modules.
We already attempted some of this before. See demergent-labs/azle#985 and #64. However, we encountered many problems with generics, and knowing which prefix to add at which level (See demergent-labs/azle#985 (comment)).

This is likely going to be a cross-repository problem/solution, with some changes implemented in the CDK Framework, and some in Azle/Kybra.