I would also prefer to use the same return type hinting compatibility rules as for argument type-hinting. May be it's less smart, but more practical.
http://en.wikipedia.org/wiki/Covariance_and_contravariance_%28computer_science%29 Thanks. Dmitry. On Thu, Nov 6, 2014 at 1:15 AM, Stas Malyshev <smalys...@sugarcrm.com> wrote: > Hi! > > > No, classes are not loaded for type checks, since it would be > pointless > > - if the class is not loaded, you could not have a value of that > type, > > so if the class is not present, the answer is "no". > > > > > > It's not true anymore, with this proposal. > > This is not good. The base premise of type checks always was if you > don't use them, they are basically free - you don't load the classes, > you don't do any work, until you actually need them, and by then your > class is supposed to be already loaded, so again it's not costly. But if > just declaring a type could trigger loading of code, this may > significantly increase the footprint and loading time for classes that > have many options but only use some of them at the time. > Also, it is kind of weird that arguments require exact match but return > types do not. Not that we care for consistency anymore... > -- > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ >