Re: Re: [RFC] Explicit call-site send-by-ref syntax
| From: | Björn Larsson | Date: | Mon, 29 Jul 2019 22:44:18 +0000 |
| Subject: | Re: Re: [RFC] Explicit call-site send-by-ref syntax | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-106330@lists.php.net to get a copy of this message | ||
Den 2019-07-25 kl. 14:32, skrev Nikita Popov:
On Wed, Dec 6, 2017 at 8:49 PM Nikita Popov <nikita.ppv@gmail.com> wrote: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 LHi internals, I'd like propose optional support for explicitly marking by-reference argument passing at the call-site, in addition to the declaration-site: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? Nikitahttps://wiki.php.net/rfc/explicit_send_by_refIn short, while currently we havefunction byRef(&$ref) {...} byRef($var);this proposal would also allowfunction byRef(&$ref) {...} byRef(&$var);so that the use of by-reference passing is obvious without having to consult the function declaration. Regards, Nikita