With Bucklescript 5.0.6, the following (ReasonML) code:
let (<&>) = (a, b) => a + b;
let (<?>) = (a, b) => a + b;
produces this .bs.js output:
// Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE
function $less$unknown$great(a, b) {
return a + b | 0;
}
function $less$unknown$great$1(a, b) {
return a + b | 0;
}
export {
$less$unknown$great ,
$less$unknown$great$1 as $less$unknown$great,
}
/* No side effect */
There seem to be two issues here:
& and ? don't seem to be recognized as valid characters in the operators, and are represented as $unknown in the js
- in the export list, the
$less$unknown$great name is being duplicated, which causes problems in webpack, etc.
If these characters are invalid, I would think the compiler would reject them rather than using $unknown. If $less$unknown$great$1 was not aliased as $less$unknown$great in the export list, that would also fix the problem of duplicate exports.
My current workaround is to use a different character in the operator, which does not result in the $unknown (e.g. ^ => $caret).
With Bucklescript 5.0.6, the following (ReasonML) code:
produces this .bs.js output:
There seem to be two issues here:
&and?don't seem to be recognized as valid characters in the operators, and are represented as$unknownin the js$less$unknown$greatname is being duplicated, which causes problems in webpack, etc.If these characters are invalid, I would think the compiler would reject them rather than using
$unknown. If$less$unknown$great$1was not aliased as$less$unknown$greatin the export list, that would also fix the problem of duplicate exports.My current workaround is to use a different character in the operator, which does not result in the
$unknown(e.g.^=>$caret).