Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103776 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 65064 invoked from network); 22 Jan 2019 19:14:29 -0000 Received: from unknown (HELO v-smtpout3.han.skanova.net) (81.236.60.156) by pb1.pair.com with SMTP; 22 Jan 2019 19:14:29 -0000 Received: from [192.168.8.9] ([94.254.95.82]) by cmsmtp with ESMTPA id lyLFgm0mJHNTSlyLFgePvq; Tue, 22 Jan 2019 16:51:57 +0100 To: Nikita Popov , Sara Golemon References: Cc: PHP internals Message-ID: <35fd7cd8-ee18-7cc3-68ea-543429c1f6dc@telia.com> Date: Tue, 22 Jan 2019 16:51:58 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB X-CMAE-Envelope: MS4wfLVJcTmq1UsRkgr8zg2qVAHdBtBZuyHpgnjft3lYZ96kST/KAoa7nIPkZqgURnefYXOK1jSDjRRlGAUDn2+lpCwkC2oAqkcC0FPlV8WsOm2mwwO8I522 Ua8Vq/7ZcGy/XO+pyXI/c1kJww6GepTZJeuZsKj0SBdZMYY/4wyDOVqAZlr4+mRxu63tQvgJzRIK3+romsjhBETrIfn+yAwyK7VJcgykgQUdS7e7giI+cEIs Subject: Re: [PHP-DEV] Coalesce assign operator (??=) implemented From: bjorn.x.larsson@telia.com (=?UTF-8?Q?Bj=c3=b6rn_Larsson?=) Hi, Excellent work! I have been waiting for this :) Sara, I came to think on the Short ternary Assignment Operator RFC. Would this implementation make that one more feasible, given it passes a vote? r//Björn Larsson Den 2019-01-22 kl. 11:33, skrev Nikita Popov: > Hi internals, > > Some time ago an RFC for the ??= operator has been accepted: > https://wiki.php.net/rfc/null_coalesce_equal_operator > > However, due to implementation difficulties, the RFC hasn't landed since > then. I'm happy to say that these difficulties are resolved now, and ??= > has landed with > https://github.com/php/php-src/commit/a50198d0fef652ca052cda642d6e98a9101eb73f > . > > To summarize the important ??= semantics: $a ??= $b is roughly equivalent > to $a ?? ($a = $b). In $a[foo()] ??= bar() the function foo() will be > evaluated exactly once, and bar() will be evaluated iff $a[foo()] is null > (or unset). > > Regards, > Nikita >