Re: [heycam/webidl] A non-optional dictionary argument makes sense at times. (#130)

I am also against changing this.

I think the issue is that we don't have any good tools in the JavaScript toolbox for expressing the requirement "please fill out at least one of these values". Speaking very generally, you're supposed to use parameters for required values, and dictionaries for optional values. But the use case presented here is neither of those.

In that case, when people choose to use dictionaries, they are going against how we have designed them in Web IDL. It's a weird fit, and will run into some semantic problems. I think it's OK for it then to be a bit awkward and exceptional and require workarounds. We should not weaken the concept of dictionaries as they are originally designed to fit this rare case where people are using them unusually.

Note that I don't think we have a good concept in Web IDL, or even in JavaScript, for expressing the "please fill out at least one of these values" idiom. (You could imagine a language with a type system that can express such constraints, but JavaScript is not it.) So abusing dictionaries for it is probably the best solution; I'm not saying you should do something else. I'm just saying we should not cater to it.

-- 
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/130#issuecomment-313461817

Received on Thursday, 6 July 2017 17:19:49 UTC