LambdaS5 icon indicating copy to clipboard operation
LambdaS5 copied to clipboard

Recursive function bindings do not follow the spec

Open tilk opened this issue 10 years ago • 0 comments

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.

tilk avatar Feb 06 '15 13:02 tilk