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

Proposal: Rewrite with untagged variants #62

Open
mununki opened this issue Jul 13, 2023 · 1 comment
Open

Proposal: Rewrite with untagged variants #62

mununki opened this issue Jul 13, 2023 · 1 comment

Comments

@mununki
Copy link

mununki commented Jul 13, 2023

Proposal

Rewriting the bindings by the polymorphic variant using the untagged variant in ReScript v11. e.g. https://github.com/rescript-react-native/rescript-react-navigation/blob/main/src/NativeStack.res#L9-L19

Benefit

Using variant versus polymorphic variant gives us more information at compile time, and is more idiomatic.

@cknitt
Copy link
Member

cknitt commented Jul 19, 2023

With all the new features regarding variants in ReScript 11, I agree that normal variants should be preferred over polymorphic variants for writing new bindings. This was also our philosophy in the new rescript-mui bindings where we make heavy use of untagged variants.

OTOH, for the case of rescript-react-navigation,

  • this would mean breaking changes with little visible benefits to the user
  • it is not just rescript-react-navigation but also rescript-react-native itself that currently prefers polymorphic variants, and we should probably remain consistent with it.

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

No branches or pull requests

2 participants