On Tue, Feb 23, 2021 at 1:05 PM Rowan Tommins <rowan.coll...@gmail.com>
wrote:
>
> On 23/02/2021 18:41, Albert Casademont wrote:
> > Sure, it's not a big deal having to write the ": null" but it doesn't
add
> > any value
>
> On the contrary, it adds an important piece of information: that the
> default value is "null", rather than "false", or "0", or "new
EmptyValue()".
>
> For instance, it doesn't seem at all obvious to me that this code should
> produce a null:
>
> $items = [];
> $itemCount = $items ? count($items);
>
> I might be more convinced that "null" is the "natural" value if the
> left-hand operand was only checked against null, not "falsiness": in
> that case, you can read it as "if it's null, leave it alone". I'd still
> be inclined towards "too specific to use up more syntax", though.
>

This sums up my feelings on the topic very well.   The proposal seeks to
remove clarity of intent to save four characters.  Hard nope as presented.

-Sara

Reply via email to