On 13/07/2014 06:22, Stas Malyshev wrote:
I have one request: could we please stop calling it "hinting"?
I've always thought the current "type hinting" should be called "type assertion", since passing the wrong data type is detected only at runtime, and causes an error in much the same way as if you wrote assert($param instanceof HintedClass).
What this RFC proposes is more like "type validation" - detecting that the given input can be safely coerced to the given type, and performing the coercion in the process. As Andrea points, out, it's similar to what Nikita called[1] "strict weak type hinting", but with the added step of performing the cast, which is really just a convenience, since if you've asked for a value to be validated as an int, you're presumably about to use it as one.
[1] http://nikic.github.io/2012/03/06/Scalar-type-hinting-is-harder-than-you-think.html
-- Rowan Collins [IMSoP] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php