Closed jchavarri closed 5 months ago
This seems to have been fixed in rescript,
Input:
let t = "\u{1F42B}"
Js.log(t)
Output:
var t = "\u{1F42B}";
console.log(t);
This won't be possible to fix without breaking compatilibity with OCaml, see #1143 for details.
I understand in Melange the way to tell the compiler that some string is a "JavaScript string" (unicode encoding) is using quoted strings with ids
j
andjs
.In the context of writing universal code, where the preprocessing for these quoted strings is not available, I tried to use the regular OCaml way to define unicode literals, e.g:
But this doesn't work as expected, as the output is quite strange:
Playground
I wonder if this is some fundamental limitation of the way Melange interop with JS?
I believe this issue is similar to what was referred to in this comment: https://github.com/rescript-lang/rescript-compiler/issues/802#issuecomment-364916644