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

Add melange version of Promise (promise.js) #80

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

davesnx
Copy link

@davesnx davesnx commented Oct 4, 2023

Fixes #79

This PR is a first attempt to migrate the promise version of previously builded from BuckleScript to Melange (and all of the related constraints).

I believe the change it's on a good direction since Melange enables sharing code and the original idea of this project seems to share the same interface between native and JS. If we want to keep the BuckleScript/ReScript version I could do a similar trick done in styled-ppx davesnx/styled-ppx#353

I vendor promise under server-reason-react here: https://github.com/ml-in-barcelona/server-reason-react/tree/main/packages/promise in order to enjoy the same experience as this library will provide (eventually will remove the vendor lib).


What are the changes:

  • Install melange and adapt dependencies (requires dune 3.10 and OCaml 5.1)
  • Remove [@bs.val] (Melange don't need those)
  • Update bs.* into mel.*
  • Updates root dune file from 1.0 to 3.10
  • Have a dune file under js/ folder where we specify the modes melange
  • Arrange completely the test folder into a more sharing code between the two targets can live together. Heavy usage of copy_files with different libraries.
  • Added a few (wrapped false) under test/ to avoid changing the source-code.

What hasn't been done:

  • Take consideration of the naming (came up with .js and .native for a few places but I don't hold any strong reasoning behind any naming)
  • Remove bs-platform, bs-config
  • Test the workflow on esy
  • Update the CI to run the new build command (and new location of compiled JS files)

Status

The proposition for this is to gather feedback about the changes and eventually release this as a new opam version.

Current test can be ran with:

# test_main
node _build/default/test/js/test/test/js/test_main.js

# benchmark
node _build/default/test/js/test/test/js/benchmark.js

@@ -243,7 +238,7 @@ let soundnessTests = Framework.suite("soundness", [

[@ocaml.warning "-33"]
test("resolved: Almost-Promise-like", () => {
let open Js_OO;
/* let open Js_OO; */
Copy link
Author

Choose a reason for hiding this comment

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

I commented this out since didn't seem needed, but wanted to acknowledge that I have no clue what's Js_OO

@@ -0,0 +1,3 @@
(library
Copy link
Author

Choose a reason for hiding this comment

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

ffi is a lib under test now, with the 2 separate versions

@@ -1,3 +1,3 @@
(library
Copy link
Author

Choose a reason for hiding this comment

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

The run file/lib isn't needed anymore since we can share framework

@davesnx davesnx marked this pull request as ready for review June 18, 2024 11:34
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.

Melange compatibility
1 participant