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

Per the current spec:

> The prose definition of a constructor must either return an IDL value of a type corresponding to the interface the [Constructor] extended attribute appears on, or throw an exception.

This means that if you want to only provide an async way to obtain an object, you *can't* use a constructor - you have to omit the constructor (so it default-throws), and then use a factory function that actually constructs the object.

Is there any appetite for being able to mark a constructor as async in some way, such that it can return a Promise for the instance?

-- 
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

Received on Thursday, 31 May 2018 23:07:49 UTC