Re: [RFC] Explicit call-site send-by-ref syntax
| From: | Nikita Popov | Date: | Thu, 25 Jul 2019 12:32:14 +0000 |
| Subject: | Re: [RFC] Explicit call-site send-by-ref syntax | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-106292@lists.php.net to get a copy of this message | ||
On Wed, Dec 6, 2017 at 8:49 PM Nikita Popov <nikita.ppv@gmail.com> 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