Andreas Rossberg (2013-08-19T15:38:26.000Z)
While debugging a V8 issue I just realised another incompatibility
with introducing lexical function declarations in sloppy mode that I
think we haven't observed yet. Consider the following code:

function f() {
  var x = 0
  try {
    throw 1
  } catch (x) {
    eval("function g() { return x }")
  }
  return g()
}

This function is legal, and supposed to return 1 according to my
reading of the ES5 spec. But lexically scoped function declarations
should make it throw a ReferenceError instead.

Unlike the other legacy issues with sloppy-mode lexical function
scoping that we have discussed before this one is actually covered by
the current spec. Is such a breaking change an issue? V8 currently
crashes on the above code, so this particular example probably is not
a real-world problem. 8) However, there are simpler examples, e.g.:

function f() {
  if (true) { eval("function g() { return 1 }") }
  return g()
}

Do we know if this is something that occurs in practice?

/Andreas
domenic at domenicdenicola.com (2013-08-23T16:04:08.082Z)
While debugging a V8 issue I just realised another incompatibility
with introducing lexical function declarations in sloppy mode that I
think we haven't observed yet. Consider the following code:

```js
function f() {
  var x = 0
  try {
    throw 1
  } catch (x) {
    eval("function g() { return x }")
  }
  return g()
}
```

This function is legal, and supposed to return 1 according to my
reading of the ES5 spec. But lexically scoped function declarations
should make it throw a ReferenceError instead.

Unlike the other legacy issues with sloppy-mode lexical function
scoping that we have discussed before this one is actually covered by
the current spec. Is such a breaking change an issue? V8 currently
crashes on the above code, so this particular example probably is not
a real-world problem. 8) However, there are simpler examples, e.g.:

```js
function f() {
  if (true) { eval("function g() { return 1 }") }
  return g()
}
```

Do we know if this is something that occurs in practice?