Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113238 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 10112 invoked from network); 23 Feb 2021 18:53:30 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Feb 2021 18:53:30 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 88B971804E1 for ; Tue, 23 Feb 2021 10:42:03 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-vs1-f51.google.com (mail-vs1-f51.google.com [209.85.217.51]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 23 Feb 2021 10:42:02 -0800 (PST) Received: by mail-vs1-f51.google.com with SMTP id j14so3481773vsi.9 for ; Tue, 23 Feb 2021 10:42:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Cw0i9yORzQDs7abTxthisWU4gNuaRR5q1tGnp2YGZEk=; b=OEqQVglEVpsaufHbz/NwCQnYNhM/FF/fGfHGi2Rq4E3USTiYJpYNIPyif0E3XezMFF oaaldOWASZpgAC8ABlCN44Xtr76djGblyVKRaRvvoLbI2gT7sEdRaaD7g3Rc9Ouo8V0T /WRQ6z2nJ/oQkwPQg8BWXIexHY/ssYr2yrUST99uyNJyf8dutXCNLakxs+lDjwd9IC9O xbxIq9wes3i8nrRsm/fzBkDt2ATR2Ax842PN0xBgEYlBiPlqgxaby/UK67jRzj5BvjFy k0e58lFxmyONn5QXP54BapJ9/53xbqClMqLbV6A33NqlyoHnBjgeuX+EzowzR2LNYikV 9s2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Cw0i9yORzQDs7abTxthisWU4gNuaRR5q1tGnp2YGZEk=; b=bydJf02CvuDBDCXLyd7xsPg1VoDmW9nt/7+Rh7JPRW34ll41z6+wotfkbVn9mHtGVO MTimdGuTE4kxW9VTRUszaSPEzQo3PWx3bOu8kRKzT3CaPTwhXacUAI4ESsMOugNfLtrf H3Jt25ghkRg8nuoEVlDl9vpZwQJ5/Kk0qeVbXBhpVtOR+ylnAo+/orV0XZo3SaQZAVZN Y2b3BzUBEAjwV7Hd/6dsGIykPNtIDwWbbZQI4vae8uZecYDMOVUoMvdlSvATfRkXNydx YrPY4Exzol+b5gCzUj8gPhTP5GiN4i2CYQwMyuMA718idcL+Q8NGTLOkp++iXeZM5KeV lFBw== X-Gm-Message-State: AOAM530F3+7B3S3KY61TsbM6+86cj3G0D/HBZe0lHELPaGM3/PR5/Cn/ He4kMSlXFqAFy47G8Ges0Caa7Rt/DW13tAC457qXF1AHchU= X-Google-Smtp-Source: ABdhPJw3nqNn/XRUYyNNqiG87qNuWqoxTaOna0QdsKMGEyxdFiV41mvVcgLqqnj91C+ULaO4FxVBPn7H6mvle7QmDHo= X-Received: by 2002:a67:8944:: with SMTP id l65mr2349539vsd.54.1614105719791; Tue, 23 Feb 2021 10:41:59 -0800 (PST) MIME-Version: 1.0 References: <2664e2ef-b965-407c-90fc-77480846a3ad@www.fastmail.com> In-Reply-To: <2664e2ef-b965-407c-90fc-77480846a3ad@www.fastmail.com> Date: Tue, 23 Feb 2021 19:41:48 +0100 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="0000000000000eea1305bc05461f" Subject: Re: [PHP-DEV] Inline conditional that returns null if falsy From: albertcasademont@gmail.com (Albert Casademont) --0000000000000eea1305bc05461f Content-Type: text/plain; charset="UTF-8" On Tue, Feb 23, 2021 at 6:28 PM Larry Garfield 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. --0000000000000eea1305bc05461f--