On Mon, 21 Jan 2013 19:03:09 +0100, Nikita Popov <nikita....@gmail.com> wrote:

I've opened the vote on the proposal for the alternative accessor
typehinting syntax:

https://wiki.php.net/rfc/propertygetsetsyntax-alternative-typehinting-syntax#voting

The vote is done under the assumption that the main accessors RFC will
pass. If it does not, then this proposal is no longer relevant.


I've voted "No" due to concerns I mentioned in most part in IRC, but which I think should be here on the record. So my voting statement:

I'm voting against this proposal because I think the proposed syntax strongly suggests that the property is bound to a specific type. This has several problems:

* It's a promise that's not guaranteed. As long as the getter is allowed to reference the value of the variable can arbitrarily be changed to whatever type. It may also be possible to do the same with unserialization. * The benefits are minimal. The only real benefit is cutting maybe two lines of code in an indisputably common scenario. * The idea of bounding a variable to a type, even if it worked with no loop holes, should be examined with much more care than this. We have nothing analogous already. It's a misleading argument to say this is just a syntactic sugar (technically it is), because it carries a strong psychological implication by analogy with other languages like Java. And of course, it it had no loopholes, it would mean that we would have gone to great lengths to force the property to be of a certain type, and then we would not be able to claim it was just a syntactic sugar. So the feature is either broken or it's not just syntactic sugar. * And yes, next we'll start discussing extending this to other variables. Yes, this is a slippery slope argument. Slippery slopes are a real phenomenon. People interested in this topic can read this reference [1].

[1] https://www.law.ucla.edu/volokh/slippery.pdf

--
Gustavo Lopes

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

Reply via email to