melange-re / melange

A mixture of tooling combined to produce JavaScript from OCaml & Reason
https://melange.re
Other
846 stars 52 forks source link

Support unicode in regular strings #1142

Closed jchavarri closed 5 months ago

jchavarri commented 5 months ago

Fixes #1141.

Tbh, I am not 100% sure about all the implications of removing the \x escaping on regular strings on the generated JS. But no tests were exercizing this case (otherwise they would have broken) and there are options available in case this feature was used: there are much more explicit alternatives to manipulate sequences of bytes than using strings, like Bytes.t in OCaml or ArrayBuffer which could be consumed in Melange through bindings.

The only caveat is that locations seem to be broken when unicode strings are used, but this seemed to be the case already before the changes in this PR, as the first commit shows.

jchavarri commented 5 months ago

See https://github.com/melange-re/melange/pull/1143.