mikewest / tc39-proposal-literals

Literals could be different than non-literals.
32 stars 4 forks source link

How should this proposal interact with eval? #3

Open littledan opened 6 years ago

littledan commented 6 years ago

When Adam Klein presented this proposal at the November 2017 TC39 meeting, one of the committee's questions was, how should this proposal interact with eval? In one possibility, literals encountered within an eval would be treated as verified literals. Note that eval is not the only way that new code is executed; e.g., in the Web Platform, you can insert a new <script> tag, and in Node.js, the vm interface provides other ways to execute code.

Whenever code can be executed from user strings, if it is validated as a literal, this feature is made ineffective. On the other hand, if those things are treated as "not a literal", this might interact poorly with various kinds of code loading systems, which may be trusted.

Potential solutions discussed in the committee: