khi gia
Apr 28, 2008
10:21am
Polymorphic variants ... or tagged tuples :)
I was nearly decided to ask on ocaml list when is it recommended to use polymorphic variant instead of variants … but this blog post just came handy at the right time! :)
Need to read more ocaml code to find some patterns where programmers like polymorphique variants.
By the way, this intro may looks complicated … although it isn’t! At first, we can compare those polyvariants with tagged tuples; in fact in practice it is very similar to Erlang tuples which begin with a tag as atom, although ocaml add type checks!
Page 1 of 1