This is the proposal to change the default unbox configuration, currently:
type t = A (int)
type t = {a : int}
These are boxed by default, to unbox it, it requires the attribute @unboxed.
I am planning to change the default behavior so that we have unboxed by default, and the user has to add @boxed attribute to preserve the old behavior. (Note that @boxed attribute is not a new attribute, it already exists there)
The major motivation is not for performance, but for the convenience of some special encoding. For example, we have rank-2 polymorphism with records:
I think I agree that this may create confusion. In the case of records, it would break any bindings for JS objects with only one field.
That’s not a concern for variants, but I also don’t see how this makes higher-rank polymorphism easier. On the ReScript side, you would still have to write code exactly the same as before. The only difference would be the JS output.