Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107698 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 12799 invoked from network); 25 Oct 2019 15:31:43 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 25 Oct 2019 15:31:43 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id DE9812D1FD1 for ; Fri, 25 Oct 2019 06:18:22 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp3.php.net X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: X-Spam-Virus: No Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp3.php.net (Postfix) with ESMTPS for ; Fri, 25 Oct 2019 06:18:22 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id p4so2303275wrm.8 for ; Fri, 25 Oct 2019 06:18:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=H9I49Ql5Xfwx2Rh3blLy5SxDEd4qZ5wNYhbc7Kloerg=; b=ZQQRb06uEKuts5wMD0jp4EmZj+LLFlrZzk9yZt7QqhX8OFf6f84bpyyv6Dgi1HytW/ qd1wA20j0b8dZVnuxMnReW/6nKhYEsKHSKfipC97cbvNEJrSFKsp0LadbI39UV/LDHVp 2TU5kf4zxxU15JO31xqPJd+DQm5HS60yuhq9lo7V87t7B89b+NugN0HkRnZBxg6NH7cx gfBEk6FoWnKp/9BxQ4AA8is8t2JkGrQvP/i9d8SAXrD0sTJPoRsitsyiY4pLs/IhtABl xWP8RhAv1k0Mdx4Zd2AcU017irweecQcxPj82shxaTOcwNHr7SqupBlfq24fvhkZzVT7 MfsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=H9I49Ql5Xfwx2Rh3blLy5SxDEd4qZ5wNYhbc7Kloerg=; b=QKkZuR8Mddn6l9autlmc7kmIgNkxpDKWFmMjmVbkkATO+2ATw67rkvjmXZNvl6eLx6 Elmbid6CYX8clgk+A3aJmjR/duaDS4AUkZ8LMdpKtCAJ8BJaGvtenDoj45lrh3PSqGMl hAgyr4jVLQey+oX+6kY/vvSiMRpbFeSfprvCqZog2S7o6LyY6W7NEIwX2FHLaKEvp0y5 KQ4CzWknpUW3yL6YwEsCCkZUsdkc6+t2yzKZ+A7i92l5LHCMoqX80w84SP55dC3Yfddt aqAKlnQslRJ4x/qdvuJDlsYmI1dcUpOaVTy+hEIaQ6lp+K4GNJegY4vk2f028j/12LIJ g9fQ== X-Gm-Message-State: APjAAAXdKuxNf5suJmW9nsmd393grgCM7BoqfeuCn1d78bd5sX5rrde4 oQKM2D6TF/wc6nsyOE+y/CbNajqFkzw= X-Google-Smtp-Source: APXvYqylQEN/FzG3TZ8aRRFPt9mNak6T/DreaamLoSTdlNNYGexIFZYqYbxJ48opgdwjjRQeVl8yyg== X-Received: by 2002:adf:e74c:: with SMTP id c12mr2960916wrn.133.1572009501456; Fri, 25 Oct 2019 06:18:21 -0700 (PDT) Received: from [192.168.0.63] (84-75-30-51.dclient.hispeed.ch. [84.75.30.51]) by smtp.gmail.com with ESMTPSA id h17sm2445073wme.6.2019.10.25.06.18.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Oct 2019 06:18:20 -0700 (PDT) Message-ID: <6A3CFA20-0209-427F-9842-D2C1D1FC43D3@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_61CA3CF4-E3F0-4732-8E29-9C95F449D203" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Date: Fri, 25 Oct 2019 15:18:19 +0200 In-Reply-To: Cc: Andreas Hennings , Dan Ackroyd , PHP internals To: Ken Stanley References: X-Mailer: Apple Mail (2.3445.104.11) X-Envelope-From: Subject: Re: [PHP-DEV] [RFC] anti-coalescing-operator From: claude.pache@gmail.com (Claude Pache) --Apple-Mail=_61CA3CF4-E3F0-4732-8E29-9C95F449D203 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Le 25 oct. 2019 =C3=A0 04:36, Ken Stanley a =C3=A9cri= t : >=20 > So far it seems like the biggest concern(s) is that we would most = likely > repeat the use of variables (nothing new), and that there are other = ways to > do the same thing (again, nothing new). And of course the most valid > argument of all: adding more operators to the soup mix. Personally, I = don=E2=80=99t > see these as show stoppers, at least given that the idea is not too = wild > and out there. Hi, If you write A !?? B instead of isset(A) ? B : null you gain a *fixed* amount of 12 characters. The gain is proportionally = low when A and B are not trivial expressions. (The difference is fixed, = because the proposed operator does not allow to reduce possible = repetition of expressions.) I don=E2=80=99t think that you gain readability or clarity. In = particular, I am particularly confused with your last example: > /** > * @ParamConverter(name=3D=E2=80=9Capplication=E2=80=9D, ...) > */ > public function myAction(Request $request, Application $application) > { > $user =3D $application->getUser() !?? $this->getUser(); >=20 > // ... do something with user, without worrying about it being null. > } because if $application->getUser() is null, then $user will be null, and = you do have to worry about it being null, which makes me wonder whether = there is some bug here. If it is really what you meant, spelling *null* = explicitly will make it clearer, despite of being 12 characters longer. = And if it is not what you meant, the bug will appear more readily: /** * @ParamConverter(name=3D=E2=80=9Capplication=E2=80=9D, ...) */ public function myAction(Request $request, Application $application) { $user =3D isset($application->getUser()) ? $this->getUser() : null; // ... do something with user, without worrying about it being null. = (sic) } =E2=80=95Claude --Apple-Mail=_61CA3CF4-E3F0-4732-8E29-9C95F449D203--