reprocessing icon indicating copy to clipboard operation
reprocessing copied to clipboard

Port to OCaml and OPAM

Open bluddy opened this issue 7 years ago • 9 comments

It'd be lovely to have Reprocessing supported on OCaml proper and installable via OPAM.

It's unlikely js_of_ocaml would be able to handle the webgl stuff, but native should be fine.

bluddy avatar Apr 16 '18 19:04 bluddy

jsoo does have at least some webgl support. It includes a demo or few in the source tree. Sadly the rendered docs and hosted demo are currently down due to a host migration.

hcarty avatar Apr 16 '18 19:04 hcarty

This is on me I think. We'd need to get bsb-native on OPAM. I have an issue open https://github.com/bsansouci/bsb-native/issues/41 but haven't been prioritizing it because other people have been complaining about things a bit louder than you ;) I'd love some help with this, as I'm not the most familiar with OPAM.

bsansouci avatar Apr 16 '18 19:04 bsansouci

Any reason why you prefer to go with this approach? Shouldn't it be possible to just add some jbuild files?

bluddy avatar Apr 17 '18 01:04 bluddy

@bluddy I think we want to keep the simplicity of the bsb-native setup for reprocessing. That said I’d love to make this available for opam and jbuilder users. I’m working on making bsb-native output the files that jbuilder / ocamlfind can understand :)

bsansouci avatar Apr 17 '18 03:04 bsansouci

One thing that complicates "just adding some jbuild files" is the use of bsb-specific constructs for cross-compilation. ex: https://github.com/Schmavery/reprocessing/blob/cf49e18f5385b6684b50114650158bd0b0de1b13/src/Reprocessing_Hotreload.ml#L7-L11

Maybe the jbuild file could copy over some precomputed version of this file but it would be somewhat labour-intensive to get set up everywhere. We used to use a ppx to do this swapping, but ran into issues with it on Windows, plus using the builtin functionality is easier and faster than needing to depend on a ppx.

Schmavery avatar May 18 '18 20:05 Schmavery

The OCaml-y way to accomplish this is using the cppo preprocessor. Files are sometimes given a .cpp.ml extension to indicate that they're using this preprocessor. Dune has a section in the manual describing how to use cppo files.

bluddy avatar May 22 '18 19:05 bluddy

Yeah this would work, though we'd need to use cppo's syntax, but I think getting bsb-native up on opam will be a better move. Once that's done, it'll be usable from a bsb-native project or a jbuilder project.

bsansouci avatar May 22 '18 19:05 bsansouci

Circling back on this. I'd like to port a variation of the Asai/Uehara OCaml Universe library to run in the browser. I was hoping to layer it on top of Reprocessing. Is anything happening with porting Reprocessing to OCaml? Thanks!

dogfishbar avatar Jun 24 '19 23:06 dogfishbar

Hey @dogfishbar, thanks for checking in -- to be clear, there's nothing stopping anyone from writing reprocessing apps/libraries in OCaml, the build system handles having .ml or .re files without any extra configuration. This issue is more for mirroring the reprocessing-related npm libraries on opam.

Schmavery avatar Jun 25 '19 18:06 Schmavery