-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Organize some general modules into dune libraries #1206
Conversation
I have to say I'm not a huge fan. While this indeed cleans up the module structure, the thing which we should arguably care about more, namely a meaningful organization of the source code overall, is worse after this PR. This will make it impossible for students or new people to contribute without going for a fishing expedition in a huge mess of modules all living in some Consider, e.g.,
There is a reason those were in three separate folders. By creating a big ball of mud, we're not doing ourselves any favors. Can this somehow be fixed while still keeping the modularization? CC @jerhard @stilscher for opinions. |
It's not any bigger of a mess than we already have with everything together in one namespace that ignores all directory structure, so there's even no way to properly organize modules. All three modules you mention are actually something I'm hoping to eventually get rid of altogether:
I could do all that and a lot more in this PR but that makes it a monster which will be very difficult to keep up to date and let alone merge. Not to speak of all other branches (including from students) that would go into huge conflicts. Currently this PR is mostly just file moves, which git can easily follow. As is, The current directories aren't useful for students anyway because all the modules live together in one dune library. Unless you know by heart, which subdirectory something is in, you have to jump to files by name/jump to definition anyway. For example:
Because it's one big namespace, everything has been just placed with little care because it makes no difference. A particularly fun gem is |
Another motivation for ever achieving modularization is to get rid of this mess: Lines 14 to 53 in d9afd55
In a perfect world, all the apron analyses would be in a separate optional dune library and that's it! Without taking the first step with this PR, that will never be possible otherwise because domains and analyses cannot be separated into dune libraries without extracting a common base. That is because Goblint itself ( Moreover, the unqualified subdirs mode that we use to put all the modules from all subdirectories together into one dune library is little used by others and thus comes with dune bugs that require workarounds on top of workarounds: Lines 67 to 72 in d9afd55
analyzer/src/analyses/apron/dune Lines 1 to 3 in d9afd55
There's little interest from dune developers to maintain this largely unused mode: ocaml/dune#4383, ocaml/dune#4381, etc. |
I tried and it turns out it's possible to have the old directory structure also in common with I also added odoc pages to give a better overview of our dune libraries. I locally confirmed that merges cleanly with #1093 and #1201. After merge they compile without changes and pass all tests. |
This is a first step towards reducing the spaghetti module dependencies that we have inside the mostly monolithic
goblint_lib
dune library. From the bottom of the module dependency graph, I took leaf modules (without dependencies) and some of their parents and organized them into three new dune libraries.The only way towards such better organization is to do it bottom-up because there's no other way without cyclic dependencies: can't extract witnesses into a dune library because
goblint_lib
needs witnesses and witnesses need some general modules fromgoblint_lib
(likePrintable
).Coding-wise, this doesn't really change anything right now because the libraries are either still unwrapped or always opened, so the modules from those libraries are accessible in
goblint_lib
just like before.The exact modules in
goblint_std
andgoblint_common
aren't yet ideal, but further splitting requires splitting of some module files and rethinking their internal dependencies.TODO