3 ms·
> I’m a bit lost because Ocaml has a Pascal-like syntax OCaml's syntax is not particularly Pascal-like. It'd be very hard for someone to mistake Pascal code fo
by Jtsummers 2y ago
> I’m a bit lost because Ocaml has a Pascal-like syntax
OCaml's syntax is not particularly Pascal-like. It'd be very hard for someone to mistake Pascal code for OCaml or vice versa.
- StopDisinfo910 2y agoOcaml has the same ALGOL roots as Pascal (which is what I meant by Pascal like) and you can see the influence in the syntax: words pairing for blocks (begin/end, do/done), same use of ":". Keywords are quite close. It obviously went through ML but you can tell the influence.
- trealira 2y agoIf you compare OCaml and Standard ML, which came before it, it seems like OCaml is a lot like SML but with some changed syntax for convenience, and imperative features syntax for featyres that were technically supported by SML but still awkward, and I think it's in those imperative parts where they most resemble Pascal and Algol. They added "begin" and "end" as keywords equivalent to parentheses, they added for loops, and classes, and changed array syntax to resemble other languages more (by using square brackets to indicate an array subscript). http://adam.chlipala.net/mlcomp/ http://adam.chlipala.net/mlcomp/