Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101264 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26642 invoked from network); 8 Dec 2017 04:42:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Dec 2017 04:42:02 -0000 Authentication-Results: pb1.pair.com smtp.mail=php-lists@koalephant.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=php-lists@koalephant.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain koalephant.com designates 206.123.115.54 as permitted sender) X-PHP-List-Original-Sender: php-lists@koalephant.com X-Host-Fingerprint: 206.123.115.54 mail1.25mail.st Received: from [206.123.115.54] ([206.123.115.54:50480] helo=mail1.25mail.st) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6A/11-11466-7181A2A5 for ; Thu, 07 Dec 2017 23:42:00 -0500 Received: from [10.0.1.27] (unknown [49.48.241.12]) by mail1.25mail.st (Postfix) with ESMTPSA id 9FCD860411; Fri, 8 Dec 2017 04:41:51 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) X-Mailer: iPhone Mail (15C114) In-Reply-To: Date: Fri, 8 Dec 2017 11:41:46 +0700 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <670DE052-934C-4EFE-9B70-C59736EAFAD1@koalephant.com> References: <91639df6-4fbd-a649-6558-7ae9130020ff@telia.com> To: "lists@rhsoft.net" Subject: Re: [PHP-DEV] [RFC] Explicit call-site send-by-ref syntax From: php-lists@koalephant.com (Stephen Reay) > On 8 Dec 2017, at 08:54, "lists@rhsoft.net" wrote: >=20 >=20 >=20 >> Am 08.12.2017 um 01:38 schrieb Bj=C3=B6rn Larsson: >>> Den 2017-12-06 kl. 20:49, skrev Nikita Popov: >>> Hi internals, >>>=20 >>> I'd like propose optional support for explicitly marking by-reference >>> argument passing at the call-site, in addition to the declaration-site: >>>=20 >>> https://wiki.php.net/rfc/explicit_send_by_ref >>>=20 >>> In short, while currently we have >>>=20 >>> function byRef(&$ref) {...} >>> byRef($var); >>>=20 >>> this proposal would also allow >>>=20 >>> function byRef(&$ref) {...} >>> byRef(&$var); >>>=20 >>> so that the use of by-reference passing is obvious without having to >>> consult the function declaration. >>>=20 >> I think this proposal has a good point about static analysers, >> not just about human readability. >> A good static analyser is very helpful for eg migration projects >> and if this proposal benefits that, it's a plus. Also using same >> syntax for references like in other parts of the language has a >> value. >> Now expressing the same thing in two different ways, with or >> without & is confusing, so I think one needs to think about if >> old syntax should be deprecated in 8.0 >=20 > to get this consistent that would also require change every line of code c= alling core functions like sort instead of sort($array) as sort($array) >=20 > i doubt that the benefits could justify the BC break >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >=20 I think Rowan's suggestion makes a lot of sense. There's zero bc break for e= xisting code, but new/updated code can get the benefits of being specific ab= out how the parameter is used. I know "references are the wrong tool for any job" is a belief held my some o= f the community - I'm curious if out/inout parameters solve any of their con= cerns about references? Cheers Stephen=20=