LambdaS5
LambdaS5 copied to clipboard
Recursive function bindings do not follow the spec
The following program returns 120 in S5, should throw an exception (because the f variable should shadow the recursive binding):
var x = function f (a) { var f; if (a == 0) return 1; else return a * f(a-1) }; x(5)
Reason: ES5 chapter 13 says that a new scope should be introduced for the recursive binding, but S5's desugaring puts the recursive binding directly in the function's scope.