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
2 tasks done
dahlia opened this issue Jun 1, 2016 · 1 comment
Closed
2 tasks done

Optional default tag for union types #13

dahlia opened this issue Jun 1, 2016 · 1 comment
Labels
cat:lang Category: Language design cmp:compiler Component: Compiler backend (e.g., annotation processors, code generators) cmp:runtime Component: Target runtimes typ:enhance Type: Enhancement/new feature
Milestone

Comments

@dahlia
Copy link
Member

dahlia 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.

@dahlia dahlia added the typ:enhance Type: Enhancement/new feature label Jul 23, 2016
@dahlia dahlia added cat:docs Category: Documentation cat:lang Category: Language design cmp:compiler Component: Compiler backend (e.g., annotation processors, code generators) cmp:runtime Component: Target runtimes and removed cat:docs Category: Documentation labels Aug 26, 2017
@dahlia dahlia moved this from Chosen to In progress in Sprint at Seoul in February 2018 Feb 10, 2018
@dahlia
Copy link
Member Author

dahlia 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 as completed 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
Labels
cat:lang Category: Language design cmp:compiler Component: Compiler backend (e.g., annotation processors, code generators) cmp:runtime Component: Target runtimes typ:enhance Type: Enhancement/new feature
Projects
No open projects
Development

No branches or pull requests

2 participants