> -----Original Message----- > From: Andrea Faulds [mailto:a...@ajf.me] > Sent: Monday, July 14, 2014 7:12 PM > To: Zeev Suraski > Cc: Rowan Collins; internals@lists.php.net > Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) > > > 2. It encourages developers to get the types straight instead of > > relying on implicit casts. > > Your proposal is to just use implicit casts with no real failure cases; isn't that > encouraging developers not to care about using the correct types?
Not at all. It encourages them to care about types in the PHP spirit. You want to be more strict? No problem, you have a very easy way to carve out these specific cases by trapping E_CAST. > > 4. It allows people to go extra strict very easily, by turning E_CASE > > into errors. My guesstimate is that the majority of people won't, but > > it'll be possible and easy to do nonetheless. > > I really don't like that idea. If someone writes a function with type hints, > people shouldn't be able to make those type hints go away or become more > or less strict. They should be consistent across environments and contexts. But that's exactly what you've been pushing (catching & ignoring E_RECOVERABLE_ERROR), with two differences: - You'd like it to default to the strict behavior instead of the lax, PHP-like behavior - That behavior will be inconsistent with casting; Those 'similar, but different' are the most annoying kinds of inconsistencies IMHO... I do believe that the vast majority of people would want '32 ' and "42\n" to silently convert to 32/42, and will generally not care much about '32abc' converting to 32 either for the sake of consistency. Zeev -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php