pufuwozu/roy — Issue #99: Problems with inserted semicolons in generated JS
Author: tokland
Created: 2012-01-24 16:44:47+00:00
State: open

This Roy code:
let f x =
console.log 1
let a = 2
let b = \x -> 5*x
a * x

console.log (f 4)

Generates this JS code:

var f = function(x) {
console.log(1);
var a = 2;;
var b = function(x) {
return 5 * x;
};;
return a * x;
}
console.log((f(4)))

The double semicolons are an aesthetic problem, but the lack of semicolons in single-line expressions may lead to syntactically incorrect JS.