4 ms·
How is manual oreding of files a feature? Why would automatic ordering be a problem?
by spion 3y ago
How is manual oreding of files a feature? Why would automatic ordering be a problem?
- sparkie 3y agoRequired ordering encourages you to organize your code to form an almost directed acyclic graph by minimizing cyclic dependencies between types/functions. The only way you can have the cyclic dependencies is to include them in the same code file and use `type ... and ...`, or `namespace rec`/`module rec`, which are non-defaults and not encouraged. I have a ~300kloc project with zero cyclic dependencies between any types or functions, and its delightful to maintain and test. If I had written this in C# I would've taken the easy way out many times and just made cyclic dependencies between types, which become non unit-testable without creating mock types just to test.
- spion 3y agoWhat if the compiler detected the order itself, found cyclic dependencies and refused to compile if such dependencies exist? It can do that without requiring you to specify your order manually. Ordering by hand or C# are not the only two choices. I could implement this with a super simple prototype where you list dependnat files as comments at the top of each file. I'd honestly rather do that than reoder items in XML by hand.
- sparkie 3y agoF# can also be interpreted