Teaching OCaml
ocaml.org
Teaching OCaml
1–10 of 34 posts
Re: Teaching OCaml
#2Re: Teaching OCaml
#3AFAIK OCaml only support records, which are like C’s structs.
Edit: no, it has real objects, as stated in comments below.
Re: Teaching OCaml
#4> 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.
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.
Re: Teaching OCaml
#5Isn't the latter redundant and in violation of whatever?
Re: Teaching OCaml
#6> 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.
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.
Re: Teaching OCaml
#7> 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.
See: http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual005.ht...
Re: Teaching OCaml
#8Re: Teaching OCaml
#9Re: Teaching OCaml
#10I think "all of Ocaml compiles to JS " is a bit optimistic. AFAIK, code using Jane Street's Core stdlib doesn't work. But a lot of Ocaml code should be fine.