Superficial search says no: Import from / Export to JS | ReScript Language Manual
Cause of problem: I’m trying to translate some code from jsoo to rescript, and running into Printf.sprintf
Superficial search says no: Import from / Export to JS | ReScript Language Manual
Cause of problem: I’m trying to translate some code from jsoo to rescript, and running into Printf.sprintf
It was removed to improve bundle size. But should be possible to copy the specific modules into your project.
is sprintf do-able as a library (rather than compiler support), since it is a function whose type signature depends on the first argument (format string)
Theoretically you could do it. (In OCaml) The format string type is a normal type, but the sugar of using/overloading string literal to represent them is built-in to the compiler.
You can see the code in the OCaml stdlib in printf.ml
, format.ml
, camlinternalFormat.ml
, camlinternalformatBasics.ml
, etc.
Yes, it was reimplemented as a library (i.e. module) some time ago, the only question is whether ReScript still has syntax support for format strings, the team can answer that, but I’m guessing yes as it wouldn’t impact bundle sizes.
If your support target is Node.js you can use util.format
. or maybe you can find a shim for it.