3 ms·
OCaml accommodates imperative programming just fine: `if` without `else`, `for` loops, single semicolons as statement delimiters (without enclosing statement bl
by catnaroek 11y ago
OCaml accommodates imperative programming just fine: `if` without `else`, `for` loops, single semicolons as statement delimiters (without enclosing statement blocks in parentheses), records and objects containing mutable data, etc. OCaml isn't like SML and Haskell, which <strike>do get in your way when you want to program imperatively</strike> push you a little bit more forcefully towards programming in a functional style.
On the other hand, Haxe lacks features like higher order modules and signature ascription, which give the programmer very fine-grained control over the scope of abstractions. Haxe's abstract types are more like what ML had in the 70's, before MacQueen invented the ML module system.
- jdonaldson 11y agoOCaml provides some nice syntactic sugar for imperative programming patterns like "if" statements. But, I wouldn't really call it an imperative language, as it has its roots firmly in ML (which is not such a bad thing after all). Arguing that ML had a precursor to Haxe abstract types is well within reason, but I'm not so sure they're the same. I'll have to do some more reading.