Re: [heycam/webidl] Async constructors? (`new Foo()` returning Promise<Foo>) (#563)

So to be clear, the usage would be something like this?
```js
const sheet = await new StyleSheet(text);
```
The syntax is nice and clean in isolation. Questions that come occur to me:

* Are all constructors of an interface required to be async if any are? If not, is that confusingly inconsistent for developers or problematic for implementers? If so, does that have any weird consequences? (like allowing future polyfills/helpers to synchronously construct an empty instance, then populate it asynchronously)
* This is possible today in non-IDL JS... are there examples of libraries that do this? If so, what has developer feedback been? If not, how brave do we feel about baking a (yet another...) potentially non-idiomatic pattern into the platform?
* Any non-JS language examples out there?


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/563#issuecomment-393718490

Received on Thursday, 31 May 2018 23:58:06 UTC