Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107674 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 9174 invoked from network); 25 Oct 2019 00:06:38 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 25 Oct 2019 00:06:38 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id D2B392C306F for ; Thu, 24 Oct 2019 14:53:07 -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: AS3215 2.6.0.0/16 X-Spam-Virus: No Received: from mail-ua1-x92f.google.com (mail-ua1-x92f.google.com [IPv6:2607:f8b0:4864:20::92f]) (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 14:53:07 -0700 (PDT) Received: by mail-ua1-x92f.google.com with SMTP id n2so7643728ual.11 for ; Thu, 24 Oct 2019 14:53:07 -0700 (PDT) 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=Sk/nHFxyNinTFnJxXMsyy70uF1+clqsoZQ3wm14TAiU=; b=SI8cdh+HAJJs6Dvew6kh0Mn3ofn+SgZwioHKi5M145hNYY3VNtom1FYKHG5/wa9V1m WfAsfYXMNiFqWtpdu6pdy1Zds+AnZcb2Esr1lKxVqMtfXTeA1lCSNlcxCU1SvmEisHL0 QXP9kNj3CBJp8y6R0wBuB2tWWpz2lU3pmvBQJLzQqKrAiRm2nSdvRX6xlo+hRTiSClZC 4dFo7skoEWJWsUzjvYcPlsJQs3mENH8tEvxOF+t5VrOnfOBq4Go6CJJNpz4iGNBLBcmV z5bSUm4+zN6QJNApsPYcu7pOUy9KYuzniVMta/68S9HKzfazsOIYr2dGGe2b4VOelqOw jp8Q== 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=Sk/nHFxyNinTFnJxXMsyy70uF1+clqsoZQ3wm14TAiU=; b=KA6OVvmdDl6hd4Rpg7/MUJAwwp4GT+wGkBWDtC6+UZxx+NXSZ+pqbEKV/X9v7yoUas eNwjbr8tWSfqn6xfXypOzXYv4bpH8Ou0/tvubNQFRl2o664ZSSoX2fbHcQ8USlud0pyF DYROvr8YO/M6xhXKsmcbKwEqnLG6YUdcjRjvunkg8Rw3Sw5YQyi8yKgRK1W0ItH81mLG Yjzt4htpGWDYHFIuz4IytyBMpSsDYtQMoN8nlEWYFLb5nZG8QMZjk2/1+hY0C+yux6AF tywkqafaWBsbD/W/Fv8B+bPAzcekcmeZUXi0+u99MmbmVJJRWbbOPNxWIyAjQY8v/s60 msbw== X-Gm-Message-State: APjAAAXAmAtWkP2cQHTFs3+f+22GlSEawyemFZNbVahe0lFZy/TXyMP3 Ehr+h95pgB0c3TiSyZoIHs9cFmv32wiRqtLbHIc= X-Google-Smtp-Source: APXvYqzJZQurNon+9eQI5Ucv6JE4QgTAJVwk0465hxJLCT4FIRT1+t6cc5B1FoDf7GgSThlVg87wsWAlTxe4OYSz218= X-Received: by 2002:ab0:2654:: with SMTP id q20mr6578770uao.50.1571953987072; Thu, 24 Oct 2019 14:53:07 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 24 Oct 2019 17:52:54 -0400 Message-ID: To: Kosit Supanyo Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000000b88f0595af0fe5" X-Envelope-From: Subject: Re: [PHP-DEV] [RFC] anti-coalescing-operator From: dohpaz@gmail.com (Ken Stanley) --00000000000000b88f0595af0fe5 Content-Type: text/plain; charset="UTF-8" On Thu, Oct 24, 2019 at 5:19 PM Kosit Supanyo wrote: > Hi Ken > > I totally agree with Andreas especially: > > One purpose of the operator should be that you don't have to repeat >> the variable. Here you do, e.g. $_SERVER['fname'] > > > But if this operator provide some way not to repeat the variable it will > make sense. For example: > > $_SERVER['fname'] !?? $user->setName($$) > I asked Andreas for their opinion on why this is bad in this context? Especially since if I were to use a traditional ternary or if condition, then I'd still be repeating the variable. > > But I think this functionality should be of something like pipeline > operator: > > // send tmp variable to the next expression unconditionally > $ret = $_SERVER['fname'] |> $user->setName($$); > // send tmp variable to the next expression only when $_SERVER['fname'] is > set. > $ret = $_SERVER['fname'] ?|> $user->setName($$); > > Also the syntax like above will be consistent with the proposed > safe-navigation operators. > I'm more interested in having a negation operator for the null-coalescing operator, especially since cognatively it should be easy to discern what it does. I've personally not seen |>, and I'd be confused as to what it does (e.g., is it a bitwise OR on a greater than comparison?). Thank you! The idea of $$ is neat, but not quite what I'm trying to achieve here. If anything, wouldn't that facilitate a different RFC? - Ken Stanley --00000000000000b88f0595af0fe5--