On Tue, Jun 1, 2010 at 7:55 PM, Stas Malyshev <smalys...@sugarcrm.com>wrote:
> Hi! > > > The "optional scalar type hinting" would raise a catchable fatal error >> that could be converted to an exception. >> > > If you advocate moving PHP to full-OO with exceptions as primary error > handling mechanism, it's fine - but there would be nothing "optional" or > "hinting" about it - once you have one piece of code doing it, you'd have to > have all code that touches it (and all code that touches that code, etc.) to > be strict typed and exception-controlled. And then you'd want typed > variables and "throws" clause to methods. Maybe we better rename PHP into > Java and be done with it? :) > > type hinting for arrays and objects does the same (catchable fatal error on mismatch), whats the difference? if you start using a piece of code, which uses type hinting for non-scalar variables, you already have to deal with this kind of situation (custom error handler, or catching the exception) So from my point of view, you are arguing against the type hinting itself, which is too late IMHO. Tyrael