Re: Property Accessors v1.2 : Typehints / Accessor Syntax
| From: | Stas Malyshev | Date: | Wed, 17 Oct 2012 10:22:53 +0000 |
| Subject: | Re: Property Accessors v1.2 : Typehints / Accessor Syntax | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-63492@lists.php.net to get a copy of this message | ||
Hi!
> It is foolish to think that these two bits of code are behaviorally different:
>
> class Entity {
> DateTime $last_modified;
> }
The are different because this one looks like a strongly typed variable
which brings with it a lot of connotations which aren't immediately
obvious, and in fact most of this is not needed. 99% of use of parameter
typing I've seen is done for purely documentation purposes and that code
would break hard if these types do not match but in the code they never
do since there are no other types that end up there. I think having the
engine run a lot of extra code just for the sake of documentation is not
right.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227