|
|
|
|
|
by anuragsoni
2070 days ago
|
|
> I find the `ref` syntax of SML much nicer to use than the mutable record syntax in Ocaml. Maybe I'm missing something in SML, but OCaml has `ref` as well and it works just like SML's? let x = ref 0
x := 12
print_int !x
> SML strings are immutable which lends itself to a lot of potential optimizations (and there's always byte arrays if you actually need to mutate).OCaml's strings are also immutable. They have been immutable by default since 2017 and prior to that one could opt into this behavior via a compiler flag. |
|
2017 was just 3 years ago. Loads of Ocaml stuff rely on versions much, much older than that. In any case, the idea of outright changing a formerly mutable structure to an immutable one would be unthinkable in most languages due to all the breakages it is likely to cause.