New dev
Release
The second dev release 7.0.0-dev.2 is released for testing!
As we mentioned in the previous post, we compile records into js objects in this release. This makes the generated code more idiomatic, however, this is not enough to write idiomatic bindings to manipulate arbitrary js objects, since the key of js objects can be arbitrary which is not expressible in ReasonML syntax, so we support user level customization now, which makes idiomatic bindings really easy.
REtype entry = {
[@bs.as "EXACT_MAPPING_TO_JS_LABEL"]
x: int,
[@bs.as "EXACT_2"]
y: int,
z: obj,
}
and obj = {
[@bs.as "hello"]
hi: int,
};
let f4 = ({x, y, z: {hi}}) => (x + y + hi) * 2;
JSfunction f4(param) {
return (((param.EXACT_MAPPING_TO_JS_LABEL + param.EXACT_2 | 0) + param.z.hello | 0) << 1);
}
As you can see, you can manipulate js objects using Reason pattern match syntax, the generated code is highly efficient, more importantly, bindings to JS will be significantly simplifie.
Happy Hacking.
This article was originally released on https://bucklescript.github.io/blog/2019/12/27/whats-new-in-7-cont
Want to read more?
Back to Overview