- From: jan-ivar <notifications@github.com>
- Date: Sat, 02 Jun 2018 06:54:35 -0700
- To: heycam/webidl <webidl@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Saturday, 2 June 2018 13:55:00 UTC
Also, to the consistency argument:
Regardless of history, the semantics chosen are not POLA and seem internally inconsistent. E.g.:
```js
dictionary Foo { required long foo1; };
dictionary Bar { Foo myFoo = null; };
void doStuff(optional Bar myBar);
```
```js
Jib.doStuff(); // TypeError: Missing required 'foo1' member of Foo.
```
Note how we don't get “`Not enough arguments`” this time. Not only is our default allowed but ignored, if I remove the `optional` keyword, the compiler says:
WebIDL.WebIDLError: error: Dictionary argument without any required fields or union argument containing such dictionary not followed by a required argument must be optional, /Users/Jan/moz/mozilla-central/dom/webidl/Jib.webidl line 18:19
0:05.91 void doStuff(Bar myBar);
So it *literally* says the argument to `doStuff` is optional, and the compiler agrees. None of that adds up to `foo1` (and therefore `myBar`) being required by `doStuff()`, not even the WebIDL spec.
--
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/76#issuecomment-394089324
Received on Saturday, 2 June 2018 13:55:00 UTC