Re: [RFC] Explicit call-site send-by-ref syntax
| From: | Rowan Collins | Date: | Tue, 30 Jul 2019 08:34:19 +0000 |
| Subject: | Re: [RFC] Explicit call-site send-by-ref syntax | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-106337@lists.php.net to get a copy of this message | ||
On Tue, 30 Jul 2019 at 07:14, Nicolas Grekas <nicolas.grekas@gmail.com>
wrote:
> I think enough time has passed since php4's call-by-ref for the syntax to
> be
> reused now. I think it's unfair to call the RFC a reminiscent of
> call-by-ref BTW.
>
Firstly, please let's stop calling this a "PHP 4" feature. It was fully
supported right up to 5.2, deprecated in 5.3, and only removed in 5.4.
Secondly, I completely disagree that it's unfair to compare the two. The
syntax being proposed in this RFC (& at both call-site and definition-site)
was supported by versions prior to PHP 5.4. Those versions left it optional
at either side, which was certainly a mistake; but it was perfectly
possible (and probably common) for coding standards to require it in both
locations.
It might be a good idea to include a more thorough discussion of this
history in the RFC.
> About requiring such call-annotations using a "declare" directive it feels
> like a heated topic. But we don't need it, so let's split it appart. I
> could very well see userland tools enforce it at the CS-checking level.
> That would provide 99.999% of the target benefit
>
Unfortunately, it doesn't bring any of the benefits to static analysis that
Nikita is proposing. Indeed, it relies on existing static analysers
correctly finding the function definition to complain whether the optional
& is in place.
Including it as optional would certainly bring some benefit to readers, but
I think it's a lot less than "99.999%" of what making it mandatory would
bring.
Regards,
--
Rowan Collins
[IMSoP]