If nobody else does it, I will.
I think Andrea's 0.3 proposal was extremely well balanced, served
everyone's needs whether they would admit it or not, and who's only
failing (subjectively termed) was the use of declare(). I think
declare() is fine and not nearly as ugly as some have slandered it to
be, but I'm willing to read the winds and modify it for v0.4.Straw poll:
- <?php strict;
- <?php-strict
- use strict; (psuedo-namespace)
- <?php // strict (I don't actually like HHVM's style, but if you do...)
- declare(strict=true); (As a top-level declare only)
- declare(strict=true); (exactly as in v0.3 -- maybe you liked it)
- your write-in vote here
I'm not going to scope in union types, nullables, or falsables. We
can leave that for a followup RFC, this one is contentious enough as
it is.-Sara
Thank you so much for taking this up again, Sara!
From my userland perspective, I would prefer <?php-strict or <?php strict;
as those options are shortest and would stand out the most. However, I would
also be okay with declare(strict=true); (as a top-level declare only).
use strict; has some appeal as a familiar syntax, but I think it also has
the potential to cause confusion. Would it also have to be the first
statement in a file, or could other statements / declarations come first?
If it is required to be at the top, that would be inconsistent with existing
use statements. If not, however, then it could be easily missed among other
namespace imports.
You probably already know about this, but FWIW Andrea had an incomplete
patch for the <?php strict syntax here:
https://github.com/TazeTSchnitzel/php-src/tree/scalar_type_hints_2_strict_alt_syntax.
Thanks again,
Theodore Brown