archives

« Bugzilla Issues Index

#3305 — Unclear semantics of call site object caching (12.2.8.2.2)


Section 12.2.8.2.2 makes the identity of call site objects dependent on the equivalence of "source code", but it is not clear what this equivalence is. Is this a structural equivalence or an identity relation?

In particular, with

let sites = [];
function g(o) { sites.push(o) }
function f() {
eval("g`bla`");
}
f();
f();
eval("g`bla`");

would the two template literals share the same call site object? The two calls to f? That is which ones of the three objects in sites are supposed to be the same?


https://mail.mozilla.org/pipermail/es-discuss/2014-July/038343.html

> Allen wrote:

BTW, eval brings up an interesting question:

let t = "tag`hello, ${world}.`";
eval(t);
eval(t);

or
new Function(t)();
new Function(t)();

Do each of these pairs compile into different call sites or are they the same call site? I'm inclined to say different. That each parse of an input string whither via eval, the function constructor, or module/script loading represent a logically distinct input into the ES environment.

<


fixed in rev29 editor's draft as per Nov 2014 TC29 meeting decisions.

templates are canonicalized by their raw string element sequence.


fixed in rev29