RE: [PHP-DEV] Syntactical change to Scalar Type Hints RFC
| From: | François Laupretre | Date: | Sun, 08 Feb 2015 20:43:32 +0000 |
| Subject: | RE: [PHP-DEV] Syntactical change to Scalar Type Hints RFC | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-82170@lists.php.net to get a copy of this message | ||
> De : Andrea Faulds [mailto:ajf@ajf.me]
> Instead, I’m wondering if the following might be better:
>
> <?php strict
>
> Which would be used like so:
>
> <?php strict
>
> function foobar(): int {
> return 1.0; // error!
> }
>
> It’d be a per-file directive, so there’d be zero mixing of modes within one
> file, and you’d avoid the quirks of declare().
'<?php' is not a 'per-file' directive, as it can appear several times, and is
not always the first item in a file.
What would this mean :
Lines of data
...
<?php
php code
?>
Data
<?php strict
Code
...
Would it be strict or not ? or will you interpret the first '<?php' only ? What is the
syntax exactly ? Does it make 'strict' a reserved keyword ?
I am sorry but, IMO, it adds ambiguity to declare()'s ugliness.
François