Hi!

> 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.

We had usage of this syntax for similar, but different purpose before it
was removed. Reinstating it now would be confusing, and generally not a
good practice - having one syntax mean different things in different PHP
versions is not good.
It is not likely that we'd ever want to make it mandatory, due to the
overwhelming mass of code relying on the current syntax, and without it
instead of making code more clear, it would make it more confusing - if
& means by-ref, does absence of it mean by-value? Nope. So you still
have to check. Unless of course you rework all existing code to add & -
which would be rather hard and will make it incompatible with every
currently supported version of PHP.
All this to achieve no other benefit but a purely cosmetic one which a
good IDE could easily deliver to you for free without changing language
syntax. I do not think it is worth it.

-- 
Stas Malyshev
smalys...@gmail.com

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

Reply via email to