> That's how all internal functions work. It looks like you didn't > actually read my argument but just repeated "I want my use case".
Sorry, I read all you said and understood it perfectly. > I know you want strict typing. I even proposed the option for it. No, you're wrong. I NEVER EVER said we should have "strict typing" in detriment of coercive types simply because there is no general consensus about what "strict" means :) But I also don't want to have coercive type hints to occupy the best "syntax slot" that could be used for more strict type checks in the future, being "strict" a negotiable term that deserves more debate. I'm just claiming that `(int) $num` is more explicit, has no BC breaks and should, IMMO, be the preferred choice. You can disagree with that, of course, but don't quote "I want my use case" as being something I said, wished or even though. > But if you read "function bar(int $num)" in the PHP manual, coercive typing is > exactly what it means. That's how it has been since forever. Sorry, but this is the syntax used by the manual to describe functions usage, not the actual implementation. The manual can be updated. The implementation itself can't be changed after major version release. 2015-01-15 21:54 GMT-03:00 Stanislav Malyshev <smalys...@gmail.com>: > Hi! > >> The hole point (at least for me) for being against `function bar(int >> $num){}` to achieve type coercion is that the syntactic equivalent >> code `function bar(array $numbers){}` won't do any coercion - (array) >> $numbers - because BC break would be too big to handle. >> >> Having `int|integer|bool|float|real|string` as coercive type hints >> while `array` is "strict" looks like an ugly hack (no pun intended). > > That's how all internal functions work. It looks like you didn't > actually read my argument but just repeated "I want my use case". I know > you want strict typing. I even proposed the option for it. But if you > read "function bar(int $num)" in the PHP manual, coercive typing is > exactly what it means. That's how it has been since forever. > > It has nothing to do with arrays, because - repeating it in like 10000th > time in this discussion - arrays are not scalars and PHP does not coerce > non-scalars, only scalars. You can make scalars work like non-scalars - > that would mean turning PHP into strongly typed language, like Python. > -- > Stas Malyshev > smalys...@gmail.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php