Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107686 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 51959 invoked from network); 25 Oct 2019 03:08:02 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 25 Oct 2019 03:08:02 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id A73192D1FC9 for ; Thu, 24 Oct 2019 17:54:34 -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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Virus: No Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) (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 ; Thu, 24 Oct 2019 17:54:34 -0700 (PDT) Received: by mail-qk1-x729.google.com with SMTP id p10so228576qkg.8 for ; Thu, 24 Oct 2019 17:54:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=cydfHOXu6U6KoK04QBl5Ssvuji9oblDeWCbrsY+1uZo=; b=ApETa22YLt+WSdgbZkpzw1PUmDuQ/5bX5tHi/ZwPgmXulDHbh9eG+r1rPLNxaIMJtS fHFUuwbAT0nAoni0dZ6trgV1z+VtB0xOWxYXHtPHGL8u9JchhUPu7ltYMRQc2/mcaJBj IjJSyjVcIDVdAy8HBBXmMwZAWJQAAf7qpxvCqMCMktQ39P4FeUQa4aS6GgGctvoW8Tyt RzSQSgPuLEX9ZHS9OMqaMtpBz1b+ea2pWwUlK2gOzm6FQ3CNEg1m2M9vJJKSELYY5Xek fuDANXKshWW251wUBXkm5V0maL8Ink8q4isHqcC16q8fWRykYRqo9ky+fc22ggMg1L/p so1w== 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=cydfHOXu6U6KoK04QBl5Ssvuji9oblDeWCbrsY+1uZo=; b=dmsI3auQr2PRmEfP1/pPLuo8WRJRx+Z496KgYkV6zP1y19FE5g6ZNr8fINXcj4f9Rz mQ1we5p6bC5oxJr5ZKq61+QjjVI0/iIZ5iFZTL50UoDwfc8W5sMP3i4z9OcLWE44Ptm7 YAcK9aFTwdaW4z4ov0OfFk/aN6mTsEcPeAAA7uEZmWqjuuykrnxtqrf7nt28kJkpfN/K IdDIRVxcHpHFrBmm/+CnciydDcbofKXm4+vJusuQDNsz7CoVu0l/JfljDDEyDANhnSyO rzBSPHHzurlIbZ6KqfwtlPGmTYRkutMwYiYovxK7qu/hFcMg0Fp2kaCfl/vSWKcMFSIH 0qRw== X-Gm-Message-State: APjAAAVlZTP88aELZCQzkodFssbV42eJPVcIiGiRLlW5ir+WLbYQd52F ltDlZ/7qL27bpUBmLXtrjkQEcA== X-Google-Smtp-Source: APXvYqxN86PuNJSyQNfkYVxwGeBwO8R9ENy3TToHeMPnvq7ilI5SE+IXB+1iLRl1qfCKdDbDwivnHg== X-Received: by 2002:a37:6ec3:: with SMTP id j186mr691339qkc.224.1571964873574; Thu, 24 Oct 2019 17:54:33 -0700 (PDT) Received: from [10.31.0.88] (static-207-255-160-162.paw.cpe.atlanticbb.net. [207.255.160.162]) by smtp.gmail.com with ESMTPSA id r2sm554451qtc.28.2019.10.24.17.54.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Oct 2019 17:54:32 -0700 (PDT) Message-ID: <09AB755E-4A05-4D19-8276-BFD658D92EED@newclarity.net> Content-Type: multipart/alternative; boundary="Apple-Mail=_48F9D3A3-AAFC-4BC2-B48B-792B66E1CC96" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Date: Thu, 24 Oct 2019 20:54:31 -0400 In-Reply-To: Cc: PHP internals To: Ken Stanley References: <5db21f54.1c69fb81.eda99.d428SMTPIN_ADDED_MISSING@mx.google.com> X-Mailer: Apple Mail (2.3445.104.11) X-Envelope-From: Subject: Re: [PHP-DEV] [RFC] anti-coalescing-operator From: mike@newclarity.net (Mike Schinkel) --Apple-Mail=_48F9D3A3-AAFC-4BC2-B48B-792B66E1CC96 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Oct 24, 2019, at 6:49 PM, Ken Stanley wrote: > I would be keen to see the more expressive techniques that retain the > succinctness of having a not-null coalescing operator. When I read your first example, I immediately thought I would handle = your example in this way: $user->setFName( $_SERVER[ 'fname' ] ?? null ); $user->setLName( $_SERVER[ 'lname' ] ?? null ); $user->setMName( $_SERVER[ 'mname' ] ?? null ); $user->setPhone( $_SERVER[ 'phone' ] ?? null ); $user->setEmail( $_SERVER[ 'email' ] ?? null ); Admittedly it does not require the functionality of your proposed = operator, and it delegates the null handling to the set*() methods, but = it is more succinct and does not require duplicating `$_SERVER[ '*' ]`, = so it would be a winner for me.=20 I also do not mind putting more effort into writing functions if it = means less effort required to call the functions. But maybe that is just = me? Your 2nd example was more compelling for me, but Sara's nullsafe calls = RFC uses a syntax that is more clear and obvious to me. Is there a 3rd or 4th use-case you have that are unlike the first two? -Mike --Apple-Mail=_48F9D3A3-AAFC-4BC2-B48B-792B66E1CC96--