Re: Why does a JavaScript class getter for a private field fail using a Proxy?

2020-07-15 Thread Jordan Harband
So can: ```jsx const o = { foo() { if (o.foo !== this) { throw 'detected'; } } }; o.foo(); // works new Proxy(o, {}).foo(); // throws ``` (as would a class that used a closed-over WeakMap for each "private field") Private fields do not introduce any new hazards here. On Tue, Jul 14, 2020 at

Re: [Proposal] Allow rest parameter on try... catch

2020-07-15 Thread Logan Smyth
I'm not sure this fits nicely into things. The issue is that `Promise.all` rejects as soon as it gets _any_ errors, so your `catch` block will run before there are multiple errors. The syntax used around `Promise.all` should not influence the behavior of `Promise.all` itself, so the only way to do

[Proposal] Allow rest parameter on try... catch

2020-07-15 Thread Michaƫl Rouges
Hi all, My proposal's goal is really simple: provide a way to handle any numbers of errors, at once, in a synced try... catch. The problem: -- ` async function reject (key) { throw new Error(`error with key: ${key}`) } async function test () { try { await

Re: Are ES Modules garbage collected? If so, do they re-execute on next import?

2020-07-15 Thread Mark S. Miller
Only a module registry as a whole may be GCed. During the lifetime of any one module registry, it can only grow. No other solution is possible. Btw, I remember being surprised ages ago when the same issue came up for the Java ClassLoader. A classLoader holds on to all the classes it ever loaded.