Poll: Deciding on The Specification Type Submodule Structure #19
trent-reed
started this conversation in
Polls
Replies: 1 comment 1 reply
-
Okay, seems like it's basically just me and one other person who responded to this. I'll bend towards option (3), so let me state the final expectations:
So we can head towards an option (3) implementation; Separate specification types by prefixes, and put non-trivial types (per the above definition) in separate submodules (and expose it via a re-export). Thanks everyone! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey All!
Seems like most of the conversation in #18 is about how to organize the types. To see what some of the other organization methods look like, I tried them out. I wanted to give them all a fair shake. I tried to come up with a list of 2 pros and 2 cons to keep things unbiased.
Please reply to this poll with your preferences!
I will leave this open for the 1 week, and then I will start heading in a direction based on the poll.
(1) By Prefixes (New File Per Type)
This was my orginal suggestion in #18.
You create a new file per type and then you separate the types into submodules based on their common prefix.
Example: https://github.com/trent-reed/tpm-rs/tree/dev/trent-reed/restructuring/tpm2-rs-base/src/types
Pros
Cons
(2) By Prefixes (One File Per Prefix)
This is what @oddcoder suggested in #18.
In this case we separate the types only by prefix, but we don't create any submodules past that.
Example: https://github.com/trent-reed/tpm-rs/tree/dev/trent-reed/restructuring-flat-prefixes/tpm2-rs-base/src/types
Pros
Cons
(3) By Prefixes (One File Per Prefix; Non-Trivial Types in New File)
This is what @oddcoder suggested in #18.
This is just a special case of (2), where we split any types that have custom functionality not defined by a macro into a submodule (or as they start becoming large or unwieldy).
Example: https://github.com/trent-reed/tpm-rs/tree/dev/trent-reed/restructuring-flat-prefixes-for-simple/tpm2-rs-base/src/types
Pros
Cons
(4) By Suffix (New File Per Suffix)
This is what @bradlitterell mentioned in #18.
In this case, we basically break the types up by their suffix instead of their prefix. This will cause related types to be located in the same file with one-another.
Example: https://github.com/trent-reed/tpm-rs/tree/dev/trent-reed/restructuring-flat-suffixes/tpm2-rs-base/src/types
Pros
Cons
2 votes ·
Beta Was this translation helpful? Give feedback.
All reactions