W3C home > Mailing lists > Public > public-media-capture@w3.org > February 2016

Re: Using enums to avoid default true in "settings dictionaries" (#466, #467, #471)

From: Martin Thomson <martin.thomson@gmail.com>
Date: Fri, 19 Feb 2016 16:51:55 -0800
Message-ID: <CABkgnnVObBT0bkLE13D=EwserBUPOksc9_9GU-NZ0PAVwxM9CA@mail.gmail.com>
To: Jan-Ivar Bruaroey <jib@mozilla.com>
Cc: Peter Thatcher <pthatcher@google.com>, Harald Alvestrand <harald@alvestrand.no>, "public-media-capture@w3.org" <public-media-capture@w3.org>
On 17 February 2016 at 19:50, Jan-Ivar Bruaroey <jib@mozilla.com> wrote:
> So the only difference here would appear to be mental: In that, undefined,
> being falsy, is arguably a valid input to a boolean, i.e. users might
> reasonably expect undefined to produce false, not true, and they would be
> right.


The problem is when you have:

dictionary Foo {
  boolean bar = true;
};

That is the discouraged pattern.  Because undefined is converted to
true in direct violation of the usual truthy/falsy conversions
pattern.
Received on Saturday, 20 February 2016 00:52:24 UTC

This archive was generated by hypermail 2.3.1 : Saturday, 20 February 2016 00:52:24 UTC