3 ms·
> OCaml is a high-level language that supports […] object-oriented programming style AFAIK OCaml only support records, which are like C’s structs. Edit: no, i
by hk__2 12y ago
> OCaml is a high-level language that supports […] object-oriented programming style
AFAIK OCaml only support records, which are like C’s structs.
Edit: no, it has real objects, as stated in comments below.
- tel 12y agoJust looking at the table of contents here http://caml.inria.fr/pub/docs/manual-ocaml/objectexamples.html http://caml.inria.fr/pub/docs/manual-ocaml/objectexamples.ht... seems to state otherwise. That said, I think the common advice is to not use most of that and to restrict yourself to just records as they are almost always the better choice.
- mjt0229 12y agoOCaml has a sophisticated object system. See: https://realworldocaml.org/v1/en/html/objects.html https://realworldocaml.org/v1/en/html/objects.html You can do a lot of traditional 'OO'-style things with functors and modules, though, so you don't need objects necessarily to get a lot of OO features.
- wk_end 12y agoOCaml is (somewhat unconventionally) object-oriented; it has classes, inheritance, what-have-you. The 'O' in the name stands for "objective". Perhaps you're thinking of SML? See: http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual005.html http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual005.ht...