What do you call a set/group/collection of OCaml classes?

If an OCaml package is a set of OCaml modules, what do you call a set/group/collection of OCaml classes?

In Java, a package is a set of Java classes. Reference: Java Packages

There is no name for a collection of classes in OCaml.
However, in many languages there is a name for a collection of compilation units, which happen to be classes in Java. (disclaimer: I never used java). In OCaml, compilation units are modules which can be bundled into a library.

Language Compilation unit Bundle of compilation units
C (unix) source file .c compiled into object file .o archive library .a, dynamic libraries .so
Java source file .java compiled into a .class package
OCaml (native) source file .ml compiled into .o, .cmx library .a, .cmxa
Ocaml (bytecode) source file .ml compiled into .cmo library .cma
3 Likes

How about ‘School’ - seems appropriate :slightly_smiling_face:

4 Likes

To add on to monoidoid’s answer, purely in terms of organizational hierarchy, in the OCaml ecosystem,

module item < module < library < package

Packages are what can be installed using opam.

And a class is considered a ‘module item’. (So is a module, of course.)

1 Like

I am not happy with the paralelism between Java packages and archives (.a, .cms, .cmxa).

In Java, a package is a hierarchical way to name classes and avoid conflicts. The usual convention is to use your reversed domain (com.ibm.my_research_unit.my_class is unlikely to match your java class name !). There are some added semantics with protected which opens the access from the same package, but not from outside.

And Classes (whatever the packages) are typically bundled in .jar files which are the homologous of .a, .cma, cmxa.

The model has been evolved in Java 9 with modules. Modules are better encapsulated since only “exported” classes are visible from other modules.

1 Like

If possible, can someone please kindly let me know how can we recommend Mr. Betteridge’s/njb’s suggestion to be formally included in the OCaml language specification?

This is because people who want to use object-oriented programming, or object-functional programming, with OCaml, can use this concept to model a school of classes in UML diagrams.

1 Like