Re: [w3ctag/design-reviews] Realms API ECMAScript Proposal (#542)

@kenchris @LeaVerou and I looked at this during a breakout this week and we have some questions (I have some follow-on questions I'll post in a separate comment):
1) our understanding of `importValue` is that the second argument names an exported value from the imported module, and it's that exported entity that is returned. Is this correct? 
  a) If so, how would one get the default export of a module?
  b) Presumably if one wants multiple exports from a module, they'd need to call `importValue` once for each export. Hopefully the module is only actually imported once?
  c) Have you considered a mechanism where multiple exports can be retrieved in one call? e.g. `const [foo, bar] = realm.importValues('module.js', ['foo', 'bar']);`
  
 2) The mechanism for how values are passed back and forth seem unclear from our reading. There are mentions of transferrables, but presumable non-transferrable objects are copied in each direction?
  a) if objects are copied, this leads to more questions, are they individual copies for every invocation? e.g.: `const doSomething = realm.importValue('module.js', 'doSomething);
       doSomething(someObject, someObject);` does the `doSomething` function get two different copies of `someObject`?
  b) If the `doSomething()` function above returns some object that's state local to the Realm, does each return create a new copy of that object?
  
We didn't have the time to delve into compartments properly, but what's the functional difference between a Realm and a Compartment under the new proposal?
       

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/542#issuecomment-840848066

Received on Thursday, 13 May 2021 21:34:03 UTC