--You received this message because you are subscribed to the Google Groups "SES-strategy" group.To unsubscribe from this group and stop receiving emails from it, send an email to ses-strategy...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/ses-strategy/CAOwE1h2F_1DFOOW4VS0SKoAyksxGZB6Veio3uPdr3-%2BwcJeV9g%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ses-strategy/7c240af4-7e91-4519-acca-ca0e26007a91%40app.fastmail.com.
On Jun 20, 2024, at 7:59 AM, Luca Casonato <lu...@deno.com> wrote:I do not think so.The thing I thought you may be concerned about was the fact that a function created with `new Function()` could now persist state across calls, even when the host module loader disables module loading by specifier entirely, and the global object and all intrinsics that this function can reach are frozen, and the function can close over no mutable values. There would be no way to deny this capability other than to disallow the dynamic import syntax.Your example does not exhibit this behaviour, because you are closing over a value.An example:```const x = new Function(`
const mod = module { export default { counter: 0 } };
return import(mod).then((y) => {y.counter++;
return y.counter;});`);
await x() // 1
await x() // 2
```A different way to phrase this would be that you could never restrict a function to be pure from the outside.Luca
On Fri, Jun 14, 2024 at 11:21 PM Kris Kowal <kris...@kriskowal.com> wrote:
Is this formulation of the problem equivalent and equally concerning, though it makes no use of module expressions but does rely on a host-defined mapping from a module source to a module instance?counter.js```export default { counter: 0 }``````import source mod from 'counter.js';async function x() {const y = (await import(mod)).default;y.counter++;return y.counter;}await x() // 1await x() // 2```
On Jun 14, 2024, at 10:40 AM, 'Luca Casonato' via SES-strategy <ses-st...@googlegroups.com> wrote:```async function x() {const mod = module { export default { counter: 0 } };const y = (await import(mod)).default;y.counter++;return y.counter;}await x() // 1await x() // 2```
> On Jun 20, 2024, at 12:16 PM, 'Kris Kowal' via SES-strategy <ses-st...@googlegroups.com> wrote:
> The language currently holds invariant that the evaluation of an expression produces either a primitive value or a new instance.
This seems like it’s not even remotely true.
Is the word you are looking for "literals"? i.e. the evaluation of a literal currently produces a primitive value (for number, strings, bigints, booleans, and null) or a new instance that is not related in any way to the other evaluations (for objects, arrays, functions, classes, regexps).
Although I'm not sure whether function/class/module expressions
would fall in the "literals" category or not.
--
You received this message because you are subscribed to the Google Groups "SES-strategy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ses-strategy...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ses-strategy/CAEw%3DF0Fn_xwu-jYwTdnyLtbXQLjAKniFi3-LWbBU6x6EPFJwFg%40mail.gmail.com.