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?

Thanks

Anthony

On Wed, Feb 18, 2015 at 3:44 PM, Anthony Ferrara <ircmax...@gmail.com> wrote:
> Dear Internals,
>
> Since the resignation of Andrea, the mixed-mode type hint (called
> declaration in the proposal) proposal has been left abandoned.
> Considering that the ending votes were 67/34 (66.3%) with several
> no-votes being only due to reasonably minor issues with the proposal,
> I would like to re-propose her RFC with three minor modifications:
>
> 1. declare(strict_types=1) (if used) is required to be the first
> instruction in the file only. No other usages allowed.
> 2. declare(strict_types=1) {} (block mode) is specifically disallowed.
> 3. int typed variables can resolve a parameter type of float So
> calling requiresAFloat(10) will work even in strict mode.
>
> As this topic has and is being discussed to death, I have put a very
> large "discussion points" section:
> https://wiki.php.net/rfc/scalar_type_hints_v5#discussion_points
>
> I would kindly ask, before replying that you check to see if your
> question is answered in that list.
>
> If it is not, please follow up here and I will update the RFC.
>
> If your question is listed and you feel that it wasn't given proper
> due, please let's discuss that.
>
> https://wiki.php.net/rfc/scalar_type_hints_v5
>
> Considering this proposal is a minor tweak on an already-discussed and
> voted-on proposal, I plan on bringing this RFC to vote 1 week from
> today (on February 25th, 2015).
>
> Thanks,
>
> Anthony

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to