return when desugaring to closures

Mark S. Miller erights at
Thu Aug 21 19:57:10 PDT 2008

The name for the regularity that we all wish JavaScript closure have,
but don't, is "Tennent Correspondence":

It is the absence of this regularity that blocks so many attempts to
desugar other constructs into functions.

We don't have Tennent Correspondence because of misfeatures like the
mechanics of break, return, continue, this, arguments, and var. We
can't fix these, but we should avoid making the problem worse. When
you find yourself in a hole, first stop digging. The old es4 "this
function" violated Tennent Correspondence and would make the hole
deeper. I'm against.

More information about the Es-discuss mailing list