We have discussed, at length, the various ways in which browsers differ in 
their handling of functions-in-blocks:



```js

if(test) {

    function foo() { }

}

```



At the last TC-39 we approved semantics for block-scoped functions in sloppy 
mode. We did not discuss directly, that I recall, how the following should be 
handled:



```js

if(test) function foo() { }

```

Per spec I believe this is a syntax error, but all browsers seem to allow it 
(with minor differences in semantics similar to function-in-block scenarios).



Are implementers going to be making this an error or carrying forward this 
extension? If carrying forward, are there any objections to adding this 
extension to Annex B with minimal intersection semantics similar to F-I-B?



I haven't collected much data on this so I'm not sure what the prevalence is, 
but we'd err on the side of caution and continue supporting it unless other 
implementers are confident enough to remove it. If no one will be removing it, 
it makes sense to me to add this to Annex B. Eager to hear what others' 
thoughts are.

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to