On Wed, Dec 6, 2017 at 2:49 PM, Nikita Popov <nikita....@gmail.com> wrote:
> 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.
>
The way I understand this, it only provides a readability hint for the
human, yes?  As far as the compiler is concerned, you're either
confirming what it already knows, or it's throwing an error because
what you think will be pass-by-ref, won't be.

I'm not strictly against it in terms of helping readability for
humans, but that kind of information can also live in a docblock with
nearly the same force and effect (modulo the warning when the hint is
wrong).

-Sara

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to