Re: [RFC] Explicit call-site send-by-ref syntax
| From: | Stanislav Malyshev | Date: | Tue, 12 Dec 2017 06:38:54 +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-101328@lists.php.net to get a copy of this message | ||
Hi!
> I would rather discourage usage of references. Since PHP 7 the cost of
> breaking cow isn't as expensive anymore, but receiving values by value
> and returning by value is more idiomatic imo. Using objects can be more
> efficient.
Objects are kind of overkill when you just need a modifyable array. And
copying an array when you just need to add one value to a K-size array
is still not a good idea for many apps. O(n) vs O(n^2) still matters.
One should definitely be careful not to overuse refs, but there are
still valid cases for using them.
--
Stas Malyshev
smalyshev@gmail.com