- From: Darien Maillet Valentine <notifications@github.com>
- Date: Wed, 02 Oct 2019 23:19:32 -0700
- To: heycam/webidl <webidl@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 3 October 2019 06:19:54 UTC
FWIW, it seems there’s a number of ways to observe this distinction beyond just Proxy — pretty much anywhere IsConstructor is used, I guess. In addition to peeking out through various programmatic APIs, it can also impact evaluation of ‘bare’ syntax (third example below). Each of the following statements will throw a TypeError if `Foo[[Construct]]` is absent, but will not throw if it’s present:
```js
Reflect.construct(Bar, [], Foo);
customElements.define('x-x', Foo);
class Bar extends Foo {}
```
Usually it’s throw vs don’t throw, but sometimes neither throws and they just do other different things:
```js
// If Foo[[Construct]] is present, returns new Foo.
// If Foo[[Construct]] is absent, returns new Array.
Array.from.call(Foo, []);
```
> I think it'd be very strange to have callable interface objects exist at all, and be reachable via the .constructor property, if they are not also [[Construct]]able.
I agree.
--
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/698#issuecomment-537804644
Received on Thursday, 3 October 2019 06:19:54 UTC