What's in a Module? (thunderseethe.dev)
from armchair_progamer@programming.dev to programming_languages@programming.dev on 02 Aug 2023 20:37
https://programming.dev/post/1210557

threaded - newest

verstra@programming.dev on 03 Aug 2023 06:28 next collapse

Aren’t java packages strong modules? You can create circular dependencies between packages just fine.

qwertyasdef@programming.dev on 03 Aug 2023 16:35 collapse

I’m not sure this blog post makes the right comparison. Based on my admittedly limited experience, OCaml modules seem more comparable to Java classes than packages. They’re both bundles of functions and data, except the module contains data types instead of being the data type itself. Classes have basically all the features of strong modules like separate compilation, signatures (interfaces), functors (generics), namespacing, access control. These examples of OCaml modules are all things that would be implemented as a class in Java.

From this perspective, rather than Java lacking strong modules, it actually has them in the form of classes. It’s OCaml which lacks (or doesn’t need) an additional package system on top of its modules.