You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
npm install ocaml will give you a small package.json that has a postinstall script which downloads the ocaml tgz and compile it. It's sandboxed, so deleting node_modules deletes that ocaml.
A really far-fetched idea, but hey, we'll need the sandboxed ocaml compiler in the future at some point!
@chenglou , currently we already shipped the sandboxed ocaml compiler, so npm install -g bs-platform should just work(it will install the sandboxed ocaml & bs compiler), the opam is optional, does it not work for you?
@chenglou that would be cool if we can share the same compiler, is it possible for npm-ml to apply the patches bucklescript needed?
Btw, I have some plans to make our patched compiler ABI compatible with vanilla OCaml compiler so that the merlin compiled with vanilla OCaml will still work with bsc.
But it is always good to use the same compiler
Ultimately, this allows us to declare compiler as a devDependency (!), without 99 recompiles since npm shares the same package.
Somewhat related, we should learn from the js community's experience and expose artifacts that are sharable no matter what compiler version/build system you used. Might not be that realistic though.
As for patching: @jordwalke probably has better ideas.
FYI, I just landed a change in master, so the merlin compiled with either vanilla OCaml 4.02.3 or our patched compiler should work fine with bucklescript.
One thing I think about is when it reaches some maturity, npm install -g bs-platform is not a bad thing.
I am not familiar with npm, but I found one solution is doable, user always does an npm link to link your local OCaml libraries to global scope, and when we install a new OCaml library, we can check if the dependencies match with the global version, if so, then do an npm link again to link the local back to current installed package, then it should work
Bob did you see the way I figured out how to host and install findlib libraries on NPM? It also provides a way to allow "temporarily global PATH" variables which are only augmenting the path with node_modules during the time of build.
That's an example of a findlib installed library that exports a path to binary by specifying so in its package.json. The OCaml compiler in NPM-ML is another example.
I'm not aware of any books on npm, but the docs are pretty good. It's fairly simple. postinstall hooks are how you execute builds from source files distributed as npm packages.
@jordwalke we have a submodule which uses this https://github.com/bloomberg/ocaml/commits/master
I think sharing the same compiler is no longer a high priority, since now bucklescript provides ABI compatibility with un-patched compiler, the cmi generated by buckle can be consumed by vanilla ocaml and vice versa
Activity
bobzhang commentedon May 19, 2016
@chenglou , currently we already shipped the sandboxed ocaml compiler, so
npm install -g bs-platformshould just work(it will install the sandboxed ocaml & bs compiler), the opam is optional, does it not work for you?chenglou commentedon May 23, 2016
Seems like I misread the readme, sorry!
chenglou commentedon Jul 23, 2016
cc @jordwalke
@bobzhang any change to use npm-ml/ocaml? This'll allow npm-ml reason and bs to naturally share the same ocaml compiler, if the version matches.
bobzhang commentedon Jul 23, 2016
@chenglou that would be cool if we can share the same compiler, is it possible for npm-ml to apply the patches bucklescript needed?
Btw, I have some plans to make our patched compiler ABI compatible with vanilla OCaml compiler so that the merlin compiled with vanilla OCaml will still work with bsc.
But it is always good to use the same compiler
chenglou commentedon Jul 23, 2016
Ultimately, this allows us to declare compiler as a devDependency (!), without 99 recompiles since npm shares the same package.
Somewhat related, we should learn from the js community's experience and expose artifacts that are sharable no matter what compiler version/build system you used. Might not be that realistic though.
As for patching: @jordwalke probably has better ideas.
bobzhang commentedon Jul 25, 2016
FYI, I just landed a change in master, so the merlin compiled with either vanilla OCaml 4.02.3 or our patched compiler should work fine with bucklescript.
One thing I think about is when it reaches some maturity,
npm install -g bs-platformis not a bad thing.I am not familiar with npm, but I found one solution is doable, user always does an
npm linkto link your local OCaml libraries to global scope, and when we install a new OCaml library, we can check if the dependencies match with the global version, if so, then do annpm linkagain to link the local back to current installed package, then it should workjordwalke commentedon Jul 27, 2016
Bob did you see the way I figured out how to host and install findlib libraries on NPM? It also provides a way to allow "temporarily global PATH" variables which are only augmenting the path with node_modules during the time of build.
bobzhang commentedon Jul 27, 2016
Not yet, do you have a link ?
jordwalke commentedon Jul 27, 2016
https://github.com/npm-ml/menhir
That's an example of a findlib installed library that exports a path to binary by specifying so in its package.json. The OCaml compiler in NPM-ML is another example.
bobzhang commentedon Jul 27, 2016
cool, I will try again tonight, is there any good book about npm?
jordwalke commentedon Jul 27, 2016
I'm not aware of any books on npm, but the docs are pretty good. It's fairly simple. postinstall hooks are how you execute builds from source files distributed as npm packages.
bobzhang commentedon Aug 11, 2016
we have to use our own compiler since some patches needed. Feel free to reopen if you want to use our patched compiler in npm-ml
jordwalke commentedon Aug 11, 2016
Is the bucklescript repo representative of these patches?
bobzhang commentedon Aug 11, 2016
@jordwalke we have a submodule which uses this https://github.com/bloomberg/ocaml/commits/master
I think sharing the same compiler is no longer a high priority, since now bucklescript provides ABI compatibility with un-patched compiler, the cmi generated by buckle can be consumed by vanilla ocaml and vice versa