4 ms·
The do it because the first one sucked ass and the second is a huge improvement but you still have to support the old way.
by metaltyphoon 2y ago
The do it because the first one sucked ass and the second is a huge improvement but you still have to support the old way.
- sullyj3 2y agoWhich is which and why?
- metaltyphoon 2y agomod.rs came first and that made creating modules verbose as hell. Not only that but imagine having many mod.rs files open, you wouldn’t know what module you are in by just looking at the filename.
- baby 2y agoimagine having many lib.rs open?
- baby 2y agomod.rs is better, change my mind
- metaltyphoon 2y agoSure, open 5 tabs named mod.rs, so which mod are you in?
- baby 2y agoOpen 5 libs.rs, which crate are you in? Always look at full path instead of filename. A mod.rs means a much more cleaner organization, as you know that all of a folder module's content is within that module, and you don't have to look elsewhere.
- metaltyphoon 2y agoYes this would be a problem if for every module you had to create a lib.rs, which is not the case. mod.rs has a much higher # of occurrences.
- baby 2y agoI’ve worked in plenty of codebases that were split in many crates, not many folder modules