On Sun, Mar 15, 2015 at 4:52 AM, Pavel Kouřil <pajou...@gmail.com> wrote: > So - are you saying that it would be easy to remove this feature from > the language once people would realize it's register_globals (and any > other settings that change how code behaves) all over again? >
Actually, it would be very easy to remove this from the language. There is no possible way to rely on strict hints over auto-cast hints in such a way that would break your application by any meaningful definition of the word. <?php declare(strict_types=1); function foo(int $i) : int { if (!is_int($i)) die('How did we get here?'); return $i + 1; } echo foo("1"); ?> Output, after strict_types has been removed from language: E_NOTICE: strict_types is no longer supported. 2 Yes, that would have previously thrown an exception, but the behavior after removing strict types from the language really hasn't broken anything. This is nothing like removing register_globals... where entire apps silently break without any good way to track down how and where. Honestly, I think the reverse of your scenario is more likely. 1) Only the "strict_types=0" mode is implemented, using same rules as standard PHP casts. (basic_scalar_types) 2) xdebug adds a feature to enable the equivalent of strict_types=1 for debug mode. 3) People realize this is super useful and request "please allow a whitelist while debugging so I can debug my app in pieces" and ask "how can we optionally enable this during production mode?" 4) declare(strict_types=1) is proposed for support in PHP without xdebug, and is accepted. :) Finally, the voting process on these two RFCs is absurd, and even more absurd with the proposal of a third one. Very few people are going to play fair and vote YES on multiple of them, even if they would vote YES if it was the only proposal. As I've said before, the best way to reach consensus on *large, grand ideas* (i.e., not petty details) is to hold an instant runoff on a single vote. e.g., Rank your choices in order of preference: scalar_type_hints_v5, coercive_sth, basic_scalar_types, none. First to 2/3's win, after eliminating the least popular vote each round. (Could still end up with a winner < 2/3s, which would just mean the RFC failed.) I sincerely hope this type of vote is added as an option for future RFCs when appropriate, so that we never have to go through this terrible process again. (PS: I have nothing against the RFC authors; on the contrary, I respect all of the work they have put into their proposals. So big thanks to all of you!) -- Matthew Leverton -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php