Dennis, > Will you consider to let the people vote on how to enable strict mode > like discussed in the v0.4 discussion? Like this here from the "Reviving > scalar type hints" thread?
I believe that RFCs should be opinionated. I dislike the recent trend around having a lot of voting options as it only complicates things for the voter. For this reason I have chosen what I think is technically the best option and went from there. I am definitely open to changing that, but it would need to be based on technical reasons and not just "popular preference". Heck, in a recent public poll, over 20% of respondents voted for it being an ini setting. I touched on the reasons in the RFC: https://wiki.php.net/rfc/scalar_type_hints_v5#why_not_use_use_strict_instead_of_declare But let me go through them one-by-one: > Am 17.02.2015 um 00:58 schrieb Sara Golemon:> Straw poll: >> 1) <?php strict; This is new syntax, which is potentially ambiguous around what "strictness" is being applied. It limits future compatibility. Additionally, it's potentially ambiguous if a file starts with <?= strict; 4; ?>. Is that setting strict mode for a file and outputting 4? Or is it outputting the constant "strict"? Sure, this could be "solved" with a rule that it could only follow <?php, but that starts to get arbitrary and potentially confusing, given the other ways to open PHP tags. >> 2) <?php-strict STRONG -1, as it leaves potential for code disclosure if run on a earlier version of PHP. >> 3) use strict; (psuedo-namespace) Re-using namespaces to effect runtime is weird. Not to mention what's the expected behavior of block mode: <?php namespace Foo { use strict; } namespace { bar(); } ?> is bar() called in strict mode? Or in non-strict mode? >> 4) <?php // strict (I don't actually like HHVM's style, but if you do...) Comments should not affect runtime behavior. HHVM uses it as they need to affect behavior while remaining compatible with PHP. We do not have that problem. >> 5) declare(strict=true); (As a top-level declare only) >> 6) declare(strict=true); (exactly as in v0.3 -- maybe you liked it) Which had a number of people against it, with arguments about the odd behavior of declare in blocks, etc. >> 7) your write-in vote here The only other one I've seen that *might* make sense is using a strict qualifier on the namespace declaration: strict namespace Foo { } IMO this has the same issues as use strict above. However, it also seems to imply that the namespace is strict, where it's only the declarations in the file that are. I'm 100% open to technical arguments and justification to switch to another syntax. I don't believe that it should be a poll though. That's why I made a decision and backed it up. If anyone has logical arguments or disagrees, let's discuss it. That way the proposal can be improved through collaboration rather than just a blind vote. Thanks for the feedback!!! Anthony -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php