Andrea Faulds wrote on 17/03/2016 22:32:
Hi Johannes,
Johannes Schlüter wrote:
On Wed, 2016-03-16 at 19:15 +0100, Bob Weinand wrote:
Eih, only to typed properties. Everything else would be insane ;-)
Sorry for being imprecise.
Ok, quite a lot better, but still weird difference to the language.
There's a notable amount of places where references are being used and
often users aren't aware. (Binding parameters in database queries, in
order to support OUT parameters, comes to mind, many array functions
take an array, some functions use it to report error codes, ...)
I guess this will be a famous support issue.
And yeah, I'd love to "fix" all those places and get rid of the
references, but BC ... it's quite massive :-)
Disallowing references here might make users more aware of which
functions take parameters by reference, and avoid accidentally
modifying values. So this part of the RFC might be a good thing.
I'm not a fan of this kind of side-effect coupling - "because this
feature is new, it also triggers other new features". If you want no-ref
properties, that should be something a user chooses directly, e.g.
"class Foo { public noref $bar; }".
Adding an "array" typehint to something absolutely should not prevent it
being passed to sort(), IMHO.
Perhaps we could have an IS_TYPED_REF zval? You don't actually need to
store the desired type, only assert that the old and new reference
targets are of the *same* type when performing assignment.
Regards,
--
Rowan Collins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php