On 1/13/2017 8:24 AM, Wes wrote: >> >> I am baffled that this (still) works: >> > > __clone was special cased in 5.x, but special case was removed in 7.0 > means that previously you couldn't do publicly $obj->__clone(); now you can > and, yes, it's as dangerous as it looks > however, the special case was removed for a reason that i'm sure is a good > one, and i'm certain the same good reason is also valid for __construct >
What is the reason? On 1/13/2017 8:24 AM, Wes wrote: >> the only reason for prohibiting explicit __construct calls is that it makes >> PHP objects mutable > > > then don't call it explicitly, exactly like you wouldn't use reflection to > call private methods > This is one possible answer to this issue. The question is whether PHP wants to protect developers from errors and help reduce bugs by enforcing things or wants to be a purely convention based language and leave it developers to use it correctly. I am completely in favor of #1 and you seem to be in favor of #2. I actually have the impression that it is not defined which of both PHP actually is or wants to be. The introduction of scalar type hints in PHP 7 definitely points towards #1 but it could just be an outlier. -- Richard "Fleshgrinder" Fussenegger -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php