Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106330 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 34997 invoked from network); 30 Jul 2019 01:19:27 -0000 Received: from unknown (HELO v-smtpout1.han.skanova.net) (81.236.60.154) by pb1.pair.com with SMTP; 30 Jul 2019 01:19:27 -0000 Received: from [192.168.7.8] ([213.64.245.126]) by cmsmtp with ESMTPA id sENHhxDkHpIpGsENHhvBDQ; Tue, 30 Jul 2019 00:44:11 +0200 To: Nikita Popov References: Cc: PHP internals Message-ID: Date: Tue, 30 Jul 2019 00:44:18 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.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-GB X-CMAE-Envelope: MS4wfOLro6EzfovOewhdH2bnrpXesNMbvcMxg9OwsDb12mgx5nWp8NUzrtPrVWaTcaQbjCUgkI65VmpENOVMqrIJWE4rP5JGtThgde9rZgokrh2IcMUSnef5 Dt3wQw0M/gDm724YDvmijz/x8n9UpNNkB8qDeHqMBi0dZKjrsroVNb5Uik5HktGyjrL/cw5NCwEDNHmGG2Zp5q5Vi7/GnWKeUDFz9Wh0AwVaeF1+c+OGUZV3 Subject: Re: [PHP-DEV] Re: [RFC] Explicit call-site send-by-ref syntax From: bjorn.x.larsson@telia.com (=?UTF-8?Q?Bj=c3=b6rn_Larsson?=) Den 2019-07-25 kl. 14:32, skrev Nikita Popov: > On Wed, Dec 6, 2017 at 8:49 PM Nikita Popov wrote: > >> Hi internals, >> >> I'd like propose optional support for explicitly marking by-reference >> argument passing at the call-site, in addition to the declaration-site: >> >> https://wiki.php.net/rfc/explicit_send_by_ref >> >> In short, while currently we have >> >> function byRef(&$ref) {...} >> byRef($var); >> >> this proposal would also allow >> >> function byRef(&$ref) {...} >> byRef(&$var); >> >> so that the use of by-reference passing is obvious without having to >> consult the function declaration. >> >> Regards, >> Nikita >> > I've rebased and finished the implementation for this and would like to > move forward with this RFC. > > I think it can either go forward as-is, in that it constitutes the first > step towards bringing sanity to by-reference passing in the long term. Or I > could first try to push through > https://wiki.php.net/rfc/namespace_scoped_declares or some variant thereof > so that call-site reference passing annotations can be made required on a > per-library/project basis. > > As most of the feedback here has been on whether this is really worthwhile > if it's only optional, I guess the second option would be preferred? > > Nikita Hi, I like this proposal since it gives the programmer one more tool to improve readability and thereby quality of code. It will also contribute to make PHP faster. So the argument that one shouldn't encourage usage of references by introducing this, will then hinder potential performance improvements. The decision about how to make Namespace scoped declares can come later, still the ongoing discussion is valuable. r//Björn L