If union types can set its default tag it would help backward compatibility e.g.:
record name (text fullname);
// The below record type can be migrated to the above union type:
// Pseudo code — syntax is just for example
union name
= wastern-name (text first-name, text? middle-name, text last-name)
| east-asian-name (text family-name, text given-name)
| default culture-agnostice-name (text fullname)
;
The default tag is implicitly determined if the JSON object doesn’t have "_tag" field, which means the case a record type is refactored to a union type.
[x] Add default keyword. (#227)
[x] Write section about default into docs/refactoring.md.
If union types can set its default tag it would help backward compatibility e.g.:
The default tag is implicitly determined if the JSON object doesn’t have
"_tag"
field, which means the case a record type is refactored to a union type.default
keyword. (#227)default
into docs/refactoring.md.