5 ms·
Ocaml has a GC and supports class based inheritance, right?
by mcguire 10y ago
Ocaml has a GC and supports class based inheritance, right?
- loup-vaillant 10y ago> Ocaml has a GC Yes, but the language is immutable and eager by default. That makes circular references a chore. > and supports class based inheritance Yes, but hardly anybody uses that part of the language. We tend to stick with modules and variations over them.
- mookid11 10y ago> Yes, but hardly anybody uses that part of the language. We tend to stick with modules and variations over them. You can have inheritance via polymorphic variants: see Garrigue's `Code reuse through polymorphic variants`.
- loup-vaillant 10y agoI have never used polymorphic variants… Too lazy to learn.
- mercurial 10y agoActually, I think most of the OCaml GUI libraries (lambda-term, for instance) do use objects and classes, because it makes sense in that context.