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: native compat library for syncing with server-reason-react #807

Closed
wants to merge 3 commits into from

Conversation

jchavarri
Copy link
Collaborator

As server-reason-react is mirroring the API of reason-react, it becomes challenging to keep up over there with the changes done here.

We also don't want to remove the external declarations used on react.rei for performance reasons.

So the solution is to create a second react.rei that is used purely for syncing purposes with server-reason-react, until we have virtual libraries or better support for this. See companion PR ml-in-barcelona/server-reason-react#82.

@@ -0,0 +1,7 @@
(copy_files# "../React.re")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Building this library guarantees that the contract implemented in React.re is fitting the one used in server-reason-react.

Once there are breaking changes, the process will be as follows:

  • build of unused_native_compat will fail because contract is not honored anymore
  • update React.rei here to reflect new contract until build passes
  • copy React.rei over to server-reason-react
  • proceed to update implementation in server-reason-react to fulfill new contract

@jchavarri
Copy link
Collaborator Author

Talked to @davesnx offline and we decided to explore a different path, where we use server-reason-react.melange.ppx which is already removing the differences between melange and native, to process react.rei and convert externals into regular let definitions, e.g.

[@mel.module "react"]
external useMemo: ([@mel.uncurry] (unit => 'any)) => 'any = "useMemo";

into

let useMemo: (unit => 'any) => 'any;

That way, we might be able to start working towards a reason-react virtual library that includes the mli "as is" currently.

@jchavarri jchavarri closed this Oct 24, 2023
@jchavarri jchavarri deleted the native_compat branch October 24, 2023 15:49
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