Note that I’m not complaining about anything, I’m just curious about this unintuitive (at least to me) feature of OCaml, that
(int*int) is not the same thing as
int*int, as shown by the code below. I wonder if it serves a purpose, or is only an unintended consequence of the implementation chosen by the designers of OCaml ?
Thanks. Your link doesn’t answer my question directly, but I take from it that the “subtle difference” is simply a consequence of the internal representation of objects, and not something that the OCaml code writer can put to use to make his or her code more expressive.
The difference isn’t merely representation. One is a variant taking a tuple of two ints, the other is a variant taking two ints. Both allow you to store two ints in a variant, but they’re not the same thing. This has come up before: Sum type constructor declaration subtlety (and documentation wanted!)
You may find the following thread (and references therein) instructive: