What are the benefits of ES5 Strict being a fully static language?

Unlike the default language (ES5 by default), JavaScript strict mode (ES5 Strict) provides restrictions that make the language completely static. The default language is not completely statically covered due to these violations:

  • assignments to undeclared variables dynamically create implied global variables,
  • the with statement (objects are dynamic in JavaScript, so the JS engine cannot know before evaluating which names are object properties and which names are attached to the environment),
  • eval calls can dynamically add names to the environment,
  • The delete operator can dynamically delete names from the environment (works for implied global variables and variables added via eval calls).

Source: http://www.youtube.com/watch?v=Kq4FpMe6cRs&t=42m48s

I can see that the full performance of static metrics, since the JS engine can bind variables (or at least most of them) (to names in lexical environments) before evaluation. In addition, I think the program is becoming more readable and less likely to cause confusion.

However, my understanding of the benefits of a full static area is not as complete as I would like.

+4
source share

Source: https://habr.com/ru/post/1437239/


All Articles