• verstra
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

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

  • qwertyasdef
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    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.