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

Reduce enum noise #6

Merged
merged 1 commit into from
Oct 5, 2019
Merged

Reduce enum noise #6

merged 1 commit into from
Oct 5, 2019

Conversation

cspray
Copy link
Owner

@cspray cspray commented Oct 5, 2019

  • The enum implementation that was generated shares a lot of boilerplate
    among other enums and generally results in an implementation that has a
    lot of noise around it compared to what we want to achieve. To reduce
    the visual clutter in generated enums much of the functionality was
    moved out into an EnumTrait.

  • Instead of returning an arbitrary toString() we are now simply
    returning the string representation (i.e. method name used to
    instantiate your enum instance) of the enum that was generated. This is
    more inline with our Java inspiration and is also more intuitive to use
    in places where you might want to show or use the string representation.

- The enum implementation that was generated shares a lot of boilerplate
among other enums and generally results in an implementation that has a
lot of noise around it compared to what we want to achieve. To reduce
the visual clutter in generated enums much of the functionality was
moved out into an EnumTrait.

- Instead of returning an arbitrary toString() we are now simply
returning the string representation (i.e. method name used to
instantiate your enum instance) of the enum that was generated. This is
more inline with our Java inspiration and is also more intuitive to use
in places where you might want to show or use the string representation.
@cspray cspray merged commit b190964 into master Oct 5, 2019
@cspray cspray deleted the task/change-to-string branch October 5, 2019 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant