Re: [RFC][Accepted] Scalar Type Declarations V0.5

From: Date: Wed, 18 Mar 2015 13:33:33 +0000
Subject: Re: [RFC][Accepted] Scalar Type Declarations V0.5
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-85194@lists.php.net to get a copy of this message
On Wed, Mar 18, 2015 at 1:47 PM, Anatol Belski <anatol.php@belski.net> wrote: > Pavel, > > On Wed, March 18, 2015 11:05, Pavel Kouřil wrote: >> On Wed, Mar 18, 2015 at 11:01 AM, Pierre Joye <pierre.php@gmail.com> >> wrote: >> >>> >>> On Mar 18, 2015 4:56 PM, "Pavel Kouřil" <pajousek@gmail.com> wrote: >>> >>>> >>>> On Mon, Mar 16, 2015 at 10:03 PM, Anthony Ferrara >>>> <ircmaxell@gmail.com> >>>> wrote: >>>> >>>>> All, >>>>> >>>>> >>>>> Voting has been closed on the scalar type declarations v0.5 RFC: >>>>> >>>>> >>>>> https://wiki.php.net/rfc/scalar_type_hints_v5 >>>>> >>>>> >>>>> At a final score of 108:48, it has been accepted for PHP 7. >>>>> >>>>> >>>>> Thank you. >>>>> >>>>> >>>>> Anthony >>>>> >>>>> >>>>> -- >>>>> PHP Internals - PHP Runtime Development Mailing List >>>>> To unsubscribe, visit: >>>>> http://www.php.net/unsub.php >>>>> >>>>> >>>> >>>> Hello, >>>> >>>> >>>> how will these examples work btw? >>>> >>>> // a.php >>>> <?php >>>> declare(strict_types=1); function foo($fn) { $fn("1"); >>>> }; >>>> >>>> >>>> // b.php >>>> <?php >>>> require 'a.php'; foo(function (int $a) { return $a * 2; }); >>>> >>>> >>>> >>>> // c.php >>>> <?php >>>> function foo($fn) { $fn("1"); >>>> }; >>>> >>>> >>>> // d.php >>>> <?php >>>> declare(strict_types=1); require 'c.php'; foo(function (int $a) { return >>>> $a * 2; }); >>>> >>>> >>>> I can't find this in the RFC. I'd intuitively expect error in the >>>> first example and the second one to work OK. >>>> >>>> But at the same time, if there will be an error in the first example, >>>> it is IMHO a huge flaw with this RFC. :/ >>> >>> Git clone, compile, try, report. >>> >>> >>> It sounds pretty straight forward to me instead of asking the same >>> questions (in various form but it ends to the same answer). >>> >>> >>> And the patch should be applied sooner rather than later. So we can fix >>> bugs if there are actual ones in the current implementation. >> >> Hello, >> >> >> if I had time to set up the compilation of PHP on Windows, I'd do it - but >> I don't. I wanted to try it myself via >> http://3v4l.org/, but it >> unfortunately doesn't support multiple files. >> > > for anyone needing to test on Windows, there was builds for an older RFC > version > > > http://windows.php.net/downloads/snaps/ostc/scalar_type_hints_2_strict_mode/ > > but I just made quick builds for the current as well > > þ˜ñƒ > ÖÔ5Їhttp://windows.php.net/downloads/snaps/ostc/scalar_type_hints_v5/ > > So you've got the choice. > > Cheers > > Anatol > Hello, I've tried the build, and it seems like it's in the strict mode 100% by default, and the "declare" statement doesn't recognize strict_types ("PHP Warning: Unsupported declare 'strict_types'"). Is this intentional? Regards Pavel Koruil

« previous php.internals (#85194) next »