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 22:50:55 -0800
Message-ID: <CABkgnnW-H-xy28zu-034CUGYZ-D=szbWF72dB1BqD_yDBfbwpg@mail.gmail.com>
To: Peter Thatcher <pthatcher@google.com>
Cc: Jan-Ivar Bruaroey <jib@mozilla.com>, Harald Alvestrand <harald@alvestrand.no>, "public-media-capture@w3.org" <public-media-capture@w3.org>
On 19 February 2016 at 21:50, Peter Thatcher <pthatcher@google.com> wrote:
> But how does converting to an enum help at all?   Wouldn't undefined then
> just get turned into an enum value, which is truthy?

An enum ensures that all valid values that are equally truthy, so
truthy/falsy becomes irrelevant.  Yes, the default is truthy, but so
is every valid value.

> And if a truthy value of a default is discouraged, then are the only
> encouraged defaults the falsy ones (false/null/""/0/NaN)?

This is only relevant for dictionary parameters with Boolean types.
Received on Saturday, 20 February 2016 06:51:22 UTC

This archive was generated by hypermail 2.3.1 : Saturday, 20 February 2016 06:51:23 UTC