klakplok / goji Goto Github PK
View Code? Open in Web Editor NEWAn OCaml bindings generator for JavaScript libraries
An OCaml bindings generator for JavaScript libraries
I'm attempting to see how Goji scales to binding to a larger library—in particular, the Meteor framework. It's a significantly larger project than any of the example Goji bindings, but I don't think it's out of scope.
Unfortunately, I run into a lot of issues trying to figure out how to make Goji run with a larger project. As a simple example, it took me some time to realize that when breaking a binding into multiple modules I need to separately compile a .cmxs
file for each module and then list them all to goji generate
ocamlbuild -use-ocamlfind all.cmxs # depends on Tracker.ml
ocamlbuild -use-ocamlfind tracker.cmxs
goji generate -d bindings _build/tracker.cmxs _build/all.cmxs
I can try to dig into the Goji source more deeply to understand how everything is being generated, but it'd be nice to know if there are any larger bindings through Goji I could use as an example or if there is any documentation for how to use Goji "practically".
Thanks!
Hi,
The following code do not compile and seems to generate an .ml file with a wrong syntax:
callback [curry_arg "alarm" ((option_null (abbrv "alarm")) @@ arg 0)] void
In the ml file generate by goji:
(callback
if (Goji_internal.js_equals args'0 (Goji_internal.js_null)) then (
None
) else (
(Some (extract_alarm args'0))
));
Can you tell me if my code is not good or if in fact it's an error made by goji ?
If not, we just have to add parentheses to make it valid :
(callback
(if (Goji_internal.js_equals args'0 (Goji_internal.js_null)) then (
None
) else (
(Some (extract_alarm args'0))
)));
It's done by adding () in goji_pprint.ml format_if function:
(* before *)
let format_if cond bt bf =
group
(group (!^"if " ^^ align cond ^^ !^" then (")
^^ nest 2 (break 1 ^^ bt) ^^ break 1 ^^ !^") else ("
^^ nest 2 (break 1 ^^ bf) ^^ break 1 ^^ !^")")
(* after *)
let format_if cond bt bf =
group
(group (!^"(if " ^^ align cond ^^ !^" then (")
^^ nest 2 (break 1 ^^ bt) ^^ break 1 ^^ !^") else ("
^^ nest 2 (break 1 ^^ bf) ^^ break 1 ^^ !^"))")
I can make a pull request but as I don't know if we have to add some () all around in goji_pprint.ml, I will not by precaution ! :D
Excuse me if I was wrong btw !
Thanks, Eyyub.
Hello,
I'm trying to use Goji, but when I do make, I get the following errors
OCAMLPATH=. ocamlfind ocamlopt -g -package dynlink,str,unix,pprint,cmdliner,goji_lib,findlib -c goji_pprint.ml
File "goji_pprint.ml", line 9, characters 21-27:
Error: Unbound value column
I don't know if it comes from pprint, I'm using the latest version from Opam.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.