Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110338 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 68543 invoked from network); 3 Jun 2020 07:42:55 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Jun 2020 07:42:55 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5C0831804F3 for ; Tue, 2 Jun 2020 23:24:57 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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, 2 Jun 2020 23:24:56 -0700 (PDT) Received: by mail-wr1-f53.google.com with SMTP id q11so1007813wrp.3 for ; Tue, 02 Jun 2020 23:24:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seld-be.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=Yf/O32Sz3/et05ut4UCsqZdkURTJ/VLQzoGXn9hfbnc=; b=AfGd7B9dGeLDfuEc7P6I4XobaOhFVxcGCyPxKCRW/cmSC27RRQgI1+RtvtFYm0IAEf 9InWSLNgjS/4Xj9OyjABy37kfWxgdnGAuN50U0xDCutvmVnD6HQfvfbMQrM5cGyLni4H 7Qc5blvyndob+CvE56Btp4EEhpRsgyfxQedH1qNLghjoX33InEy0q5bgHcBl0bhWsK1X Uqp9BCh/Pm7FBsR2F0PkKf0IOpK1Kzr7pegh4xDt0XgDUgkoT/CzMc3jwS2rD++Tb5Yx elTBwi3Ma9j6VR+/JuKLs7iNxzuGS+VgRfElFcLpm4XXF/Izw91ifISlkX2BDB+zoH0u 28GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=Yf/O32Sz3/et05ut4UCsqZdkURTJ/VLQzoGXn9hfbnc=; b=F21gxhwRHAzn7BDAmUBt5xdzRCy/Pni2P4M5/8/ITwSAvbt98tp6/sZdyL5F2mIQDE ocYmF6X/WXYHx/nJ0csJwKw7e8p4uBsZpWTRHn30KXL8d+i2HqTskNFP6GG1nEV0zqQY upTY5sT247/BTS8QkVcf5XHe3e3zsBVms7hKgaNMWLlsQf0XE3nN4hOElgqAhvRW0yaN Ku6KDL9EHYYXY3EqEjO4JEiq6MQEDL5Y+yWA4z/Pz/qIQjxvuXX3KfsrgutGSMVJihJa Qqv7mck/KSxfz2ZxAsWG0SgWIT/9hPD/b5gwhYbU57R6dmN4UktjeHS9DvWMcITUeLdH CAgw== X-Gm-Message-State: AOAM532hxU3XMuBdN6RrbXfFtzEbBEdfFehBMs+RHT9pjAnfW1zp3AQv vylIVz4R12M2lvJdRlexOhtLk5wnIHC4fw== X-Google-Smtp-Source: ABdhPJwBpeAR0WD/VOEWg9HEqfKc0/AMqysCRG3zyqhdfBOTvym5Qp/lRD1A4rcmTfOnxT4jMEBR1w== X-Received: by 2002:a5d:400f:: with SMTP id n15mr31252770wrp.419.1591165491654; Tue, 02 Jun 2020 23:24:51 -0700 (PDT) Received: from ?IPv6:2a02:168:4b6e:0:fc9a:4bcb:1a18:293b? ([2a02:168:4b6e:0:fc9a:4bcb:1a18:293b]) by smtp.gmail.com with ESMTPSA id o9sm1370027wmh.37.2020.06.02.23.24.50 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Jun 2020 23:24:50 -0700 (PDT) To: internals@lists.php.net References: Message-ID: Date: Wed, 3 Jun 2020 08:24:47 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Subject: Re: [PHP-DEV] [RFC] Nullsafe operator From: j.boggiano@seld.be (Jordi Boggiano) On 02/06/2020 22:52, Ilija Tovilo wrote: > It introduces the nullsafe operator ?-> that skips null values when > calling functions and fetching properties. In contrast to the last few > attempts this RFC includes full short circuiting. > I like it a lot! Concise and clear RFC. From having used a similar feature in TypeScript I can say it is quite convenient, easy to get used to and makes for much leaner code. IMO not having it on array accesses isn't so bad as with arrays you can easily isset($deep['into']['the']['array']) in one go, while with objects and getters etc it tends to lead to much uglier and repetitive code like:     if ($foo && $foo->getBar() && $foo->getBar()->getBaz()) { ... } So yeah, +1 Best, Jordi -- Jordi Boggiano @seldaek - https://seld.be