Re: [webidl] Sort out when dictionaries should have default values (#76)

> So I'd like to propose that optional dictionaries always have empty dictionary as default value. What that means in practice is not clear. I guess they should use null as the default value. Sadly that's observably different from using {} if someone spews things on Object.prototype...

Would it be possible to say something like "when an ECMAScript value is not supplied for the argument, the corresponding Web IDL value is the empty dictionary"? I don't quite understand why you need a default value.

> Anyway, if we do that, then we have one problem: dictionary-to-JS conversion can give ugly results (as described in https://bugzilla.mozilla.org/show_bug.cgi?id=1226475#c0 for example).

I guess this doesn't seem like a big deal to me; having a canonical form with the same keys every time seems like a plus, even if their values are not terribly useful. But I don't feel strongly, so we can change it if you want.

> For dictionaries that have default values that will still cause them to appear (with those default values), but I can live with that, I think.

Indeed, this seems like a good thing in fact.

> Thoughts?

Overall sounds sane, although if there are cases where {} and undefined are treated differently, then I guess we are in trouble. It sounds like the Bugzilla comment 6 concern was aleviated in that regard though? Will we never have such a case?

---
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/76#issuecomment-158561154

Received on Friday, 20 November 2015 23:48:29 UTC