Skip to content

Conversation

jmdyck
Copy link
Collaborator

@jmdyck jmdyck commented Apr 29, 2019

... which was the subject of issue #1484.

This is basically @allenwb's suggested wording from
#1484 (comment)

The example string-to-be-eval'ed isn't one for which the distinctness of parse trees actually matters. Are there any simple cases for which it does?

@gibson042
Copy link
Member

The example string-to-be-eval'ed isn't one for which the distinctness of parse trees actually matters. Are there any simple cases for which it does?

Since tagged template literals expose parse node identity (cf. #890), I would try to use them. Examples (condensed into single-expression forms):

  • [0, 1].map(_ => (id => id)``).reduce((a, b) => a === b) === true
    vs.
    [0, 1].map(_ => eval("(id => id)``")).reduce((a, b) => a === b) === false
  • [0, 1].map((function(){ const id = (id => id)``, isUnique = !this.has(id); this.add(id); return isUnique }).bind(new WeakSet())).every(isUnique => isUnique) === false
    vs.
    [0, 1].map((function(){ const id = eval("(id => id)``"), isUnique = !this.has(id); this.add(id); return isUnique }).bind(new WeakSet())).every(isUnique => isUnique) === true

@jmdyck
Copy link
Collaborator Author

jmdyck commented Apr 29, 2019

Hm. This is just a Note in an introductory clause, so I'm not sure it should rely on the reader understanding template literals.

Mind you, an example in the Template Literals clause seems like a good idea. Maybe in GetTemplateObject: it has the "is the same Parse Node" test, so a Note could explain the implications of that.

@ljharb ljharb requested review from a team and zenparsing April 29, 2019 18:30
@ljharb ljharb self-assigned this May 2, 2019
Copy link
Member

@littledan littledan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems appropriate for the template caching semantics.

…39#1521)

... which was the subject of issue tc39#1484.

This is basically @allenwb's suggested wording from
tc39#1484 (comment)
@ljharb ljharb merged commit a5375bd into tc39:master May 18, 2019
@jmdyck jmdyck deleted the re_1484 branch May 22, 2019 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants