W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2013

Re: APIs that have boolean arguments defaulting to true

From: Jonas Sicking <jonas@sicking.cc>
Date: Fri, 15 Nov 2013 15:14:29 -0800
Message-ID: <CA+c2ei9v_97H6h81tgg69jqNBE2K0W_p4XbtW94KGOFfBGvBDg@mail.gmail.com>
To: Ian Hickson <ian@hixie.ch>
Cc: Boris Zbarsky <bzbarsky@mit.edu>, "public-script-coord@w3.org" <public-script-coord@w3.org>
On Fri, Nov 15, 2013 at 2:31 PM, Ian Hickson <ian@hixie.ch> wrote:
>> I would probably go even further and say that having string arguments
>> that default to something other than the empty string, or numeric
>> arguments default to something other than 0, or objects that default to
>> something other than null, in cases where empty string/0/null is valid
>> values, seems like a bad idea to me.
>
> That too.
>
> However, lest we decide therefore to make such things invalid in WebIDL...

I don't think we should make it illegal in WebIDL. Like you say, there
are situations when using a non-empty string actually makes for a less
surprising API.

Additionally, there likely will be situations where an empty string
won't be a valid value, but where we can't use enums. Mime types is a
good example of this.

Likewise I could imagine APIs which take numeric values greater than
0. Here too 0 would be an invalid value even if we use a numeric type
in WebIDL.

I could potentially see forbidding boolean values defaulting to true though.

/ Jonas
Received on Friday, 15 November 2013 23:15:27 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:19 UTC