Open WhiteBlackGoose opened 2 years ago
Note: I've filled in the Rust section so if there's something stupid there, blame me, not Goose!
I tkink that the c# way would be good: don't care about hierarchy of files or symbols
I think that F# way is good. It makes it harder to accidentally make entities mutually recursive. Big projects tend to have dependencies grow extensively and it makes it harder to see actual flow. Rust way is good too, it allows to avoid namespaces like MyNamespace.Something.Internal.SomethingSpecific
. Maybe something between will be the best
Here I want to make an overview of two things: order of files in a project, order of declared symbols in a file.
Questions
A
depends directly or indirectly on fileB
, shouldB
be prohibited from depending directly or indirectly onA
?C
There's no order of files in C#. Any symbol within an assembly can reference any other assuming the visibility level allows.
C# Top-level statements
In C# top-level statements the following rules hold:
F
A
can referenceB
only ifB
is defined aboveA
.OCaml
1, 3, 4 are the same as in F#.
TODO: is it necessary to specify the order of files in OCaml default build system?
ocamlopt
which can figure out the correct order of files.Rust
In Rust the order of the files doesn't matter, but they form a strong hierarchy based on the file structure. Each folder has a
mod.rs
, that's essentially the root of the subhierarchy. It declares and marks submodules to be exposed to the outside of this hierarchy. Anything else is basically inaccessible from the outside.