Hi, On Thu, Jan 15, 2015 at 5:31 PM, Pavel Kouřil <pajou...@gmail.com> wrote: > On Thu, Jan 15, 2015 at 4:19 PM, Jordi Boggiano <j.boggi...@seld.be> wrote: >> >> Right now, or with only weak hints, if a library decides to implement strict >> typing, they'll skip the scalar hints and check types with something like >> the assert lib [1]. A user calling it with random data would *always* get >> exceptions. There is no way for the library to use scalar hints to play nice >> with weak-typed callers as it would not be able to type check anymore in >> that case. >> > > Why would the libraries writers use the checks inside the method > instead of the typing, even in the case of the weak typing? I don't > see a single reason to do so, because if they ask for an "int" in the > method signature, they will get an int or the method won't get called > at all. See the example in the RFC with the "if (!is_int($i))".
You're basically asking what's the difference between weak and strong typing ... it's rather philosophical. It's the intent that's important, not the end result, which is why I see the caller-controlled switch as pointless. Cheers, Andrey. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php