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
Split js_of_ocaml (WIP) #541
Conversation
This is awesome, and very appreciated! I was just playing this night to see what it would take to build the compiler with as little external dependencies as possible. Another easy way to reduce dependencies is to make Base64+Yojson optional. They are only used to support source maps, and this could be packaged in a specific module (that only use Base64+Yojson in its implementation, not its interface, with a stubbed out implementation when Base64+Yojson are not available). About cppo and the dependency on OCaml:
A temporary solution would of course be to commit a processed version of util.ml for each support version of OCaml (as for files generated by menhir). (And perhaps to split Util into two modules in order to have the version-dependent part smaller.) |
Btw, why does js_of_ocaml need to map Lambda's constants to Obj.t? Does it map them finally to its own structured representation (through Parse_bytecode.Constants.parse)? [EDIT] Ah, the constants can also come from the DATA section of a bytecode executable (as Obj.t values). |
In case you are interested, I wrote another |
@bobzhang, I don't really see the point of switching from cppo to yet another preprocessor and I don't see how |
There could be a general discussion about embedding a minimal conditional compilation preprocessor directly in the OCaml compiler (although this would not solve the problem of maintaining compatibility with old versions). @bobzhang Did you mean that your preprocessor is in a shape where it could be upstreamed? @lefessan also proposed to integrate such a preprocessor right in the compiler. |
There are two separate issues. But I also did some work to extract it into a stand alone single file, so people could grab it and use it on the fly for any ocaml compiler without any dependencies. As I said, it is an option if you prefer clean deps but I am not trying to convince you to switch.. |
A dependency on cppo vs a dependency on your thing - I don't understand the idea... |
My thing is just one file: https://github.com/bloomberg/bucklescript/blob/master/jscomp/bin/bspp.ml |
The file you're pointing at is 5000 lines, not 500.
|
It is 500 lines diff and 100% honest to OCaml's lexical convention, and we will maintain both this file and the patch. |
I understand that you just made an offer, I'm just trying to understand pros/cons. |
37a39bf
to
aebe15a
Compare
Do you know if it's possible/desirable to simply register the plugin as a side effect on This would actually allow to prevent having to distribute the plugin separately, you simply add the Currently, without the split occuring in this PR, I cannot optionally depend on jsoo because I need to write this in
|
This is a natural question that people ask, but it was a intended design choice not to allow this when I introduced OCaml plugin. This would only work if the plugin module is linked in by the application. In my experience, expecting compilation units that your code does not visibly depend on to be linked nonetheless is fairly fragile ( You are the boss of "package configuration". Is there not a way you could make the dependency optional that is not too kludgy and yet generates an explicit dependency when In an ideal world, users would be able to just use |
I'm in general against generating things (it's basically indirections to work around badly designed systems). Maybe after all having to distribute your ocamlbuild rules separately is the best we can do given the current state of affairs. |
Now exported (see ocaml/ocaml#904 ). I'd suggest to adapt the code to use this the function when compiling for OCaml >= 4.05. |
0a83de5
to
5f61aad
Compare
What's the status of this? Anything we can do to help this out? |
#565 was merged |
This this a work in progress (feedback welcome)
TODO split lib
fix #265
fix #360