Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99602 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23054 invoked from network); 21 Jun 2017 23:41:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jun 2017 23:41:06 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.172 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.192.172 mail-pf0-f172.google.com Received: from [209.85.192.172] ([209.85.192.172:33339] helo=mail-pf0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 03/61-13828-2140B495 for ; Wed, 21 Jun 2017 19:41:06 -0400 Received: by mail-pf0-f172.google.com with SMTP id e7so344928pfk.0 for ; Wed, 21 Jun 2017 16:41:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=FpIsZUBWAc/pGWCCdAlenLJcDM0HbUH/bUjKLtimYoU=; b=ZZ/JzN54K3LPrkd7DPm6tUZAB2Qpw5qeJgfCzgof+VS25qwdTnDuntCYRlC/gSgt0j rm5WmvmNeXD1YtygUyeaNFTuEXRJ0nBqNiJyw1AsGXctfWImavwK6HKYQ9Nfos3yzUS0 W0Rngb8rseOJbvjQlPwMYo4SnfSEFuBzlCuel7aXGPPr4zXETxd9pWU3VrKcqoBJbpjX FMCz3JChYrV7JbMNF0trzYZbR20gIZeIrk06bBI2rE/aZtnsNjBOi/l5Txt5TdK5Ye78 vGZMbiFpW3342yIssR1FZWrfnhR5lFYkCfS5lBTJWAQGVxAm6zfEXFUmvXionf0PekpS IVIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=FpIsZUBWAc/pGWCCdAlenLJcDM0HbUH/bUjKLtimYoU=; b=J/iN9CaPQ3NohnG42OfJde+hB0jO3QgG7/RqYGCwiwsOmyHdWS+EFlyVdlj17/mk80 6ZHtf1rV2+at1PAR2E3/RfGK36rKg4AGsyWbNFRUSePFgTBMXoovm6/hBD9hFnINOJGM rZ6o63RwWkau4Nn5AU8DmFuWziV5A87MK/LUmndiigNinU+DDBmtAqO9laqLq9LHNUjd oUrwK45s9hNlREM2ZXAeVMGYuGBNo5ESm/wH5fKrbIItF7BOgqKD/3wCjXmszKEmUCT5 q7Chtxp0+1HTjVtGZCBsqfv9S+EJZPN/0D5XuFa1bgILWKJ/Y0iaEL9tEuw5pXVMjAJT e66A== X-Gm-Message-State: AKS2vOyvdUcXjpLCpuXIu6lt0MYpNqmYGw1hWF4I/dIuNnwzlI7C3f+S ON0M9pRP2Kh9WDxqYiA= X-Received: by 10.99.160.109 with SMTP id u45mr37025333pgn.138.1498088463309; Wed, 21 Jun 2017 16:41:03 -0700 (PDT) Received: from Stas-Air-5687.local (108-233-206-104.lightspeed.sntcca.sbcglobal.net. [108.233.206.104]) by smtp.gmail.com with ESMTPSA id f85sm19738297pfj.6.2017.06.21.16.41.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Jun 2017 16:41:02 -0700 (PDT) To: Sara Golemon , Andrea Faulds Cc: PHP internals References: <27.FD.13828.277AA495@pb1.pair.com> Message-ID: <098eb964-4187-f71a-f076-02fae9b042c6@gmail.com> Date: Wed, 21 Jun 2017 16:41:29 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Unary null coalescing operator From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > I think that `if ($_GET['x']?? === 1)` looks and feels a lot like `if > (@$_GET['x'] === 1)`... > > Yes, the latter has runtime performance issues and will still send > notices to error handlers and logs. But perhaps if we're going to > extend syntax, the syntax could be something along the lines of: I'd rather fix @ (or make another operator like @@ that Sara proposed) to make nullsafe access - and maybe even extend it to full expression like isset/empty does - so I could do something like @$foo['bar']->blah->foo['bah'] and have it mean "try to fetch the whole chain and if something is missing on the way return null". I kinda get the argument for PHP not doing it by default, though I personally could live with that too ;) - but I still need this thing quite frequently when dealing with all kinds of dirty data. With trailing ?? it is not clear how it would chain, and even if it chains having something at the end that changes how the expression is interpreted is both confusing and may be very hard for the parser. -- Stas Malyshev smalyshev@gmail.com