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

Move enums to main object #152

Merged
merged 1 commit into from
Aug 10, 2018
Merged

Move enums to main object #152

merged 1 commit into from
Aug 10, 2018

Conversation

kornilova203
Copy link
Member

Ref #61
Wrap enumerators in separate objects and place them right below enum type declaration.

Anonymous enums should also be in an object (otherwise code does not compile). I decided to name these objects anonymous_enum_N where N is id of anonymous enum.

I made Enum class abstract and created two subclasses: AnonymousEnum contains id, NamedEnum contains name.

@kornilova203 kornilova203 requested a review from jonas August 9, 2018 15:07
final val D: enum_enumWithPrivateMembers = 1.toUInt
}

object anonymous_enum_0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any specific reason why anonymous enums do not have the type alias?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it would even make sense to eventually just declare anonymous enum values unnested inside the main Scala object.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I think it will be better to generate type for anonymous enum, it will be more type safe then

Copy link
Member

@jonas jonas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kornilova203 kornilova203 force-pushed the move-enums-to-main-object branch from 34ff98a to 8fdf38f Compare August 10, 2018 07:37
@kornilova203
Copy link
Member Author

kornilova203 commented Aug 10, 2018

I added types for anonymous enums, so now there is only one Enum class that contains non-empty name

@kornilova203 kornilova203 force-pushed the move-enums-to-main-object branch from 8fdf38f to 326f804 Compare August 10, 2018 07:39
@kornilova203 kornilova203 merged commit d386e65 into master Aug 10, 2018
@kornilova203 kornilova203 deleted the move-enums-to-main-object branch August 10, 2018 08:16
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.

2 participants