- From: Raphael Kubo da Costa <notifications@github.com>
- Date: Fri, 05 Nov 2021 04:58:33 -0700
- To: whatwg/webidl <webidl@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/webidl/issues/1060@github.com>
I recently stumbled upon #882 while looking for language for specifying an interface's constructor steps, and that got me thinking of what's supposed to happen when: 1. There's no constructor but a new platform object needs to be created and initialized. https://w3c.github.io/screen-wake-lock/#the-request-method, for example, has a step that says "Let _lock_ be a new WakeLockSentinel object with its type attribute set to _type_". It sounds a bit too handwavy to me, but I am not sure what the stricter approach would be. Referring to [Web IDL new](https://webidl.spec.whatwg.org/#new) as in "Let _lock_ be a [=new=] WakeLockSentinel" solves half of it -- but how do you communicate the "with its type attribute set to _type_" part? Does one define a "Construct a WakeLockSentinel given _type_" operation that calls `[=new=]`, initializes a new [[Type]] internal slot and returns the new platform object (or doing it inline in the WakeLock.request() steps if that happens in only one location)? 1. There's a constructor but other algorithms also need to create a platform object. I couldn't find a `<dfn>` in Web IDL I could link to that corresponds to "create this platform object and invoke its constructor steps with these arguments". https://webidl.spec.whatwg.org/#create-an-interface-object comes close, but it looks more low-level than what I am looking for. Is one expected to go down the "define a 'initalize MyInterface with arg1 and arg2' algorithm" route, make the constructor steps just say "Invoke 'initalize MyInterface with this, arg1 and arg2'" and make other algorithms that need to create a platform object say "1. Let foo be a [=new=] MyInterface, 2. Perform "initialize MyInterface with foo, arg1 and arg2"? Isn't that redundant? -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/webidl/issues/1060
Received on Friday, 5 November 2021 11:58:45 UTC