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

Default name for reference variants #75

Closed
timothee-haudebourg opened this issue Nov 25, 2022 · 0 comments · Fixed by #76
Closed

Default name for reference variants #75

timothee-haudebourg opened this issue Nov 25, 2022 · 0 comments · Fixed by #76
Assignees

Comments

@timothee-haudebourg
Copy link
Collaborator

A common pattern in TreeLDR is to declare a union layout of the form:

Foo | &Foo

This represents a layout with two variants, either Foo or a reference to Foo. In TreeLDR, all the variants must be named. When possible a default name is given, corresponding to the name of the variant layout. However reference layouts have no names, so the previous layout must be rewritten as:

Foo | &Foo as FooRef

Since this is a common pattern, a default name should be given to the reference variant in this situation following the convention <ReferencedTypeName>Ref.

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 a pull request may close this issue.

1 participant