Functions as blocks

Brian Terlson Brian.Terlson at
Thu Mar 6 10:07:02 PST 2014

John Barton wrote:
> The biggest problem with this test is that the Alexa set selects for sites with experienced developers writing for production sites. The pattern you are trying to detect is not used in these circumstances.  

I agree that this dataset is not representative of all JS code. Although, to provide some context, the same set contains nearly 2000 sites that declare functions in blocks (~60 of those declare those functions in loops).

John Barton wrote:
> As you say "all browsers seem to allow it". Browsers made the mistake and we should not go back now and blame developers on smaller sites because they use this kind of code.

Boris Zbarsky wrote:
> Given the number of stackoverflow posts I've seen that come down to browsers not being exactly compatible on their handling of this code, its prevalence is too high to allow us to remove the behavior in simple cases.  :(

Chakra, and other implementations I imagine, will remove features that are non-standard and are unused. Getting usage data is the hard part, so anything concrete anyone can share would be helpful. I am in favor of removing this if we can convince ourselves it won't break people, but I agree that without good data the conservative approach is better.

Brendan Eich wrote:
> If no one else looks, I will try to find the bug trail.

I tried searching, and failed. Let me know if you have better luck!

More information about the es-discuss mailing list