reprocessing
reprocessing copied to clipboard
Port to OCaml and OPAM
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.
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.
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.
Any reason why you prefer to go with this approach? Shouldn't it be possible to just add some jbuild files?
@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 :)
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.
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.
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.
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!
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.