Refactor jsoo rules to use Compilation_context.t#1048
Refactor jsoo rules to use Compilation_context.t#1048rgrinberg merged 3 commits intoocaml:masterfrom
Conversation
7b784a7 to
6f2b25f
Compare
src/js_of_ocaml_rules.ml
Outdated
| end | ||
|
|
||
| let build_cm cctx = | ||
| let module Jsoo = Gen(struct let cctx = cctx end) in |
There was a problem hiding this comment.
@rgrinberg it's not immediately clear to me what is the cost of doing this. For instance the Gen functor will now be applied for every .ml file. It's fine if it only contain functions, but if we start adding toplevel values in the future performances might degrade.
I think we should stick to passing cctx explicitly here. Adding module C = Compilation_context should be enough to remove most of the clutter.
There was a problem hiding this comment.
Okay, but I think the menhir also does this. I'll just get rid of the functor, the boilerplate wasn't even that bad.
Maybe, also it's a complicated kind of plugin given that it needs to be applied to the whole workspace. |
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This is how things are done in the menhir plugin for example. The jsoo rules are a bit older so haven't yet been refactored to use this type.
cc @hhugo
PS: Should we consider making the jsoo rules a proper plugin eventually?