bs.open does not convert from ReasonML
exception Error(string);
let handlePromiseFailure =
[@bs.open]
(
fun
| Error(_) => ()
);
Formats into
exception Error(string)
let handlePromiseFailure = x =>
switch x {
| Error(_) => ()
}
The whole @bs.open is gone. I also have no idea how to express the code in the new rescript syntax.
https://rescript-lang.org/try?ext=re&code=KYDwxsAOAuCWD2A7ABAUQE7vugFAZ2nVkQHMBKAbgCgqAbYaZACwENEATegBSwFtY8wAGItYtAK7pgyALxVkyANoABAEZ4AdPEjBEAXXnIchhQDNxiE8gA+aTNhwB9MrIB8RsocpUgA
I think this is not a legacy way of handling exceptions as it has been introduced in 0.7 (https://github.com/rescript-lang/rescript-compiler/blob/master/site/docsource/Exception-handling.adoc#bsopen-type-safe-external-data-source-handling-since-170).
Sorry about this, we don't yet supported this in the new syntax.
You can leave it in the old syntax or write the code that bs.open expands to:
https://rescript-lang.org/try?code=KYDwxsAOAuCWD2A7ABAUQE7vugFAZ2nVkQHMBKAKAoBthpkALAQ0QBNaAFLAW1j2ABiTWNQCu6YMgC8yYJmzSAfBWTJYAM2QApPADpUIRLr4BhJt2oGIMBIgDy6O5GCIAakyItoOOVnRlkAG8VVWQ8AHdYaDAGZBw7ACMAK11uJhJYMB95fwAuWUMA4NDkAB80HOy-DiYAT2p4JlYAqUVkAGV4bmAq7Br6xuaQ1XKAfSVkADkkYGHkAF8Q+dlqfiC56cRZ1UWaOmQAN2ltPS4uvmBdCSTgMG9p6FH1eFE2Sj36cZkj0radXTOvH4ujATGiDF66CUIQiURijBY7GAgIuQhE4h6vmwRRC5U63RwIBaf1OPAuV2AeHg1AOPSJuKmMwm-xRwIkVJpPQARFzKDsKAFfmoSIhsLMgA
I'm currently focused on infix operators and some printer improvements, will look into this after those.
Thanks!
This syntax feature might be irrelevant in the future (aka proper new promise api)
The rescript-lang/syntax repo is obsolete and will be archived soon. If this issue is still relevant, please reopen in the compiler repo (https://github.com/rescript-lang/rescript-compiler) or comment here to ask for it to be moved. Thank you for your contributions.