On Tue, Feb 23, 2021 at 6:28 PM Larry Garfield <la...@garfieldtech.com>
wrote:

>
> 1) Please don't top post.
>

Sorry for that!


> 2)
>
> The advantage of ?: over long-ternary is that the part it lets you omit is
> of variable size, and is often verbose (nested array elements).  That's not
> the case here, as the omitted portion is a fixed length short constant
> value (": null").  So the value of the abbreviation is much less.
>

Sure, it's not a big deal having to write the ": null" but it doesn't add
any value


>
> I am also not a fan of null being commonly used, as it is a dangerous
> value.  More often I would not want null if the color were missing but some
> default color value, which would be represented by something other than
> null anyway.  And "falsy" is, as we've been reminded numerous times, a
> dangerous and tricky thing.  (I just had several PRs against one of my OSS
> libraries because it relied on falsy, which had all sorts of incorrect
> failure conditions.)
>

Agreed, it was just the first example that came to my mind, probably not
the best one. A better example would creating UUID VO's from string|null
input, there's little room for a default here.

Reply via email to