But how does converting to an enum help at all? Wouldn't undefined then
just get turned into an enum value, which is truthy?
And if a truthy value of a default is discouraged, then are the only
encouraged defaults the falsy ones (false/null/""/0/NaN)?
On Fri, Feb 19, 2016 at 4:51 PM, Martin Thomson <martin.thomson@gmail.com>
wrote:
> 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.
>