Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional default tag for union types #13

Closed
dahlia opened this issue Jun 1, 2016 · 1 comment

Comments

@dahlia
Copy link
Member

commented Jun 1, 2016

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.

  • Add default keyword. (#227)
  • Write section about default into docs/refactoring.md.
@dahlia

This comment has been minimized.

Copy link
Member Author

commented Feb 10, 2018

Remaining things after PR #227:

  • Register a new keyword default to Nirum.Constructs.Identifier.reservedKeywords set.
  • Refactor duplicated codes to union tags and defaultTag.
  • Remove __valerie__ = True.
  • Write section about default into docs/refactoring.md.

@dahlia dahlia moved this from In progress to In review in Sprint at Seoul in February 2018 Feb 10, 2018

@dahlia dahlia closed this Mar 27, 2018

@dahlia dahlia added this to the Version 0.4.0 milestone May 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.