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

OCaml support #24

Open
shinzui opened this issue Feb 26, 2018 · 6 comments
Open

OCaml support #24

shinzui opened this issue Feb 26, 2018 · 6 comments

Comments

@shinzui
Copy link

shinzui commented Feb 26, 2018

Is there any reason why this package does not support native OCaml? I quickly perused the source code and I didn't see anything JavaScript specific.

@mhallin
Copy link
Owner

mhallin commented Feb 26, 2018

The generated code uses Js.Json and Js.Dict to parse JSON with minimal runtime dependencies, as well as bs.obj to create JavaScript objects rather than OCaml objects.

We could of course generate different code depending on configuration flags. There's a similarly named project at https://github.com/andreas/ppx_graphql that might be of interest for the native case, though.

@shinzui
Copy link
Author

shinzui commented Feb 26, 2018

I looked at ppx_graphql first, but it has major limitations – the lack of support for unions is a major one.
I wish the two projects would merge. The OCaml ecosystem is already tiny, and the fragmentation makes it hard for newcomers like myself.

@wokalski
Copy link
Contributor

ppx_graphql seems a bit aborted right now. I think it’d better to concentrate the work here if someone is willing to contribute it here.

@andreas
Copy link

andreas commented Feb 26, 2018

@shinzui, I haven't spend much time on ppx_graphql recently, but I did add basic union support. If you have specific needs, I'd be happy to help if you create issues.

It would be great to consolidate efforts, and I have actually spend a great deal of time looking into this, but it seems to me that the tax of being Bucklescript-compatible is quite high. In particular you're stuck on OCaml v4.02.3, but even worse, all transitive dependencies must be BS-compatible too. For example, this means no Alcotest when writing tests.

I would love to see a united Reason/OCaml ecosystem, but it appears quite hard in practice. I wonder if there are any libraries that have pulled this off successfully to learn from?

@wokalski
Copy link
Contributor

@andreas I'm not sure it's a big problem with dependencies here. Since only the output has to be BS compatible and the ppx itself is compiled to native.

@mhallin
Copy link
Owner

mhallin commented Feb 26, 2018

Since we migrated over to distributing binaries in the npm package, I guess nothing's really preventing us from moving to the latest OCaml release as long as the output is compatible with BuckleScript as @wokalski said.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants