According to js output for variants
type family = Child | Mom(int, string) | Dad (int)
let f1 = Child
let f2 = Mom(30, "Jane")
let f3 = Dad(32)
compiles to
var f1 = "Child";
var f2 = {
TAG: "Mom",
_0: 30,
_1: "Jane"
};
First thought was: the tag key on output should be underscore _
instead of `TAG, feels a lot cleaner, and the generated js it’s shorter
var f2 = {
_: "Mom",
_0: 30,
_1: "Jane"
};
While not suggesting to change the output TAG field like above, would like to discuss if something like this has limitations or may be even worth
_
is one character, TAG
is three, seems an unnecessary waste of space
_
is consistent with generated fields prefixed with underscore, _0
, _1
, _2
…