Re: Re: [RFC-Discuss] Scalar Type Declarations v0.5
| From: | Pádraic Brady | Date: | Fri, 20 Feb 2015 00:23:53 +0000 |
| Subject: | Re: Re: [RFC-Discuss] Scalar Type Declarations v0.5 | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-83252@lists.php.net to get a copy of this message | ||
On 19 February 2015 at 23:07, Anthony Ferrara <ircmaxell@gmail.com> wrote:
> All,
>
> An interesting point was brought up related to block mode:
> https://twitter.com/drrotmos/status/568540722586107904
>
> Namely that generated file caches may need the ability to switch block
> mode on-and-off.
>
> I'm considering making the change to add that. If that happens,
> declare must be the outermost block, and no non-declare blocks would
> be allowed in the outermost scope of the file:
>
> <?php
> declare(strict_types=1) {
> //...
> }
> declare(strict_types=0) {
> //...
> }
>
> Having trailing code or code outside of the declare would be a compile error.
>
> <?php
> declare(strict_types=1) {
> //...
> }
> foo(); // compile error
>
> This behaves consistent with namespace block-mode today (though the
> strict type declaration would be required to be outside the namespace
> block).
>
> I'm considering adding it, as it's a valid use-case. What do you think?
Seems a valid use case, and the block solution is therefore the
logical step. I see no reason to exclude it.
Paddy
--
Pádraic Brady
http://blog.astrumfutura.com
http://www.survivethedeepend.com