Re: es-discuss Digest, Vol 161, Issue 2

2020-07-01 Thread Jan Krems
The current answer is in the current spec for HostResolveImportedModule : > Each time this operation is called with a specific referencingScriptOrModule, specifier pair as arguments > it must return the same Module

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

2020-07-01 Thread Mark S. Miller
No, definitely not. The table from specifiers to module instances is indexed by specifiers. Specifiers are strings, so this table is not weak. It is not a "cache" in the sense that it is allowed to drop things. Rather it is a registry of module instances. Only a registry as a whole can be gc'ed,

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

2020-07-01 Thread Isiah Meadows
That's part of the caching I'm referring to. And if the cache entry for it has been evicted, I would *not* expect it to necessarily return the same instance, consistent with the behavior with `require` and `require.cache` in Node (and similar with most other module loaders that support cache

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

2020-07-01 Thread Andrea Giammarchi
even if dereferenced, a dynamic import could re-reference it any time, and I would expect it to still be the same module, it'd be a surprise otherwise (cached things, same namespace checks, etc). On Wed, Jul 1, 2020 at 7:33 AM Isiah Meadows wrote: > Just to expand on that, if the module record