Note this is not a formal release, but the change is big that we would like to gather user feedback as early as possible.
You can try it npm i bs-platform@polyvar
After installation:
npx bsc -e '(`hello, `world) -> Js.log'
You will see the output:
// Generated by BUCKLESCRIPT, PLEASE EDIT WITH CARE
'use strict';
console.log([
"hello",
"world"
]);
/* Not a pure module */
As you can see, the polyvar hello is compiled into string literal "hello". For polyvar with payload, such as "
`a 3" it will be compiled into "{NAME:“a”,VAL:3}
This change will make interop with JS string based API much easier, feedback is appreciated!