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

Dynamic: support open enums #1244

Merged
merged 5 commits into from
Oct 8, 2023
Merged

Dynamic: support open enums #1244

merged 5 commits into from
Oct 8, 2023

Conversation

kubukoz
Copy link
Member

@kubukoz kubukoz commented Oct 5, 2023

Closes #1243

@@ -256,9 +256,33 @@ private[dynamic] object Compiler {
)
}

val theEnum = stringEnumeration(values, values)
if (shape.traits.contains(IdRef("alloy#openEnum"))) {
// the runtime representation of normal enums is Int, but for open enums it's String to support arbitrary unknown values.
Copy link
Member Author

Choose a reason for hiding this comment

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

question: should we go for a String representation for all the cases?

Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose that'd make sense.

Copy link
Contributor

@Baccata Baccata Oct 7, 2023

Choose a reason for hiding this comment

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

Although, int is fine for the closed-enum case

@kubukoz kubukoz marked this pull request as ready for review October 5, 2023 21:50
@Baccata Baccata merged commit de654f3 into series/0.18 Oct 8, 2023
10 checks passed
@Baccata Baccata deleted the dynamic-open-enums branch October 8, 2023 06:59
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.

Open enums: Dynamic support
2 participants