Re: [PHP-DEV] Re: [VOTE][RFC] Coercive Scalar Type Hints
Hi Benoit, On Sun, Mar 29, 2015 at 2:49 AM, Benoit Schildknecht bensor...@neuf.fr wrote: Why hasn't it closed ? It's way past the 25th. Vote was closed before the end date. IIRC. It's withdrawn status, I suppose. Regards, -- Yasuo Ohgaki yohg...@ohgaki.net
Re: [PHP-DEV] Re: [VOTE][RFC] Coercive Scalar Type Hints
Hi Zeev, On 11 March 2015 at 18:48, Zeev Suraski z...@zend.com wrote: Rest assured that if I see that they both seem to be failing as we near the end of the voting time, I'll retract the Coercive STH RFC - and I'll actually vote in favor of the dual mode RFC, People sometimes tell me that they think the PHP-Internals list is a toxic environment. I usually defend it, saying that it's not that bad, with people just wanting their view to be considered. However right now it is toxic, with name calling, people being contacted off-list with abusive emails and disputes about the rules of the RFC process during an RFC vote. Zeev, you have the capability of ending this drama by carrying out the promise you made to support the scalar_type_hints_v5 RFC if the Coercive RFC isn't going to pass. It would be healthier for PHP if we didn't have another 10 days of toxicity. The scalar_type_hints_v5 is currently passing, and the Coercive STH RFC is very, very unlikely to pass. Please will you carry out your promise to retract the Coercive RFC and support the other RFC a few days early, so that we can move forward getting PHP 7 ready rather than having this continued toxicity? cheers Dan Ack -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] RE: [VOTE][RFC] Coercive Scalar Type Hints
Zeev, On Wed, Mar 11, 2015 at 4:50 PM, Zeev Suraski z...@zend.com wrote: -Original Message- From: Derick Rethans [mailto:der...@php.net] Sent: Wednesday, March 11, 2015 10:37 PM To: Zeev Suraski Cc: Anthony Ferrara; internals@lists.php.net Subject: RE: [PHP-DEV] RE: [VOTE][RFC] Coercive Scalar Type Hints You're right, sorry. Reverse it then: function bar(int $x) $foo = 1.0; bar($foo); // will definitely fail in strict mode And it should fail, as logically it is the same as: $foo = 1.901 - 0.709 - 0.192; bar($foo); which is only 1, if you look at it with a small enough precision. I'm not sure what you're trying to say. The two pieces are indeed identical from all points of view - static analysis, how it would behave in strict type hinting, weak type hinting or coercive type hinting. I think Derick's point is more that: http://3v4l.org/b4S8d var_dump($foo); gives float(1) while it is != 1 (even loose). So debugging is weird, since it looks like it should work (hey, it says float(1), why isn't it passing for an int?). In strict mode, it's an error because it's a float. So it's not quite identical. Since logically it should work under your rules, but it doesn't work. And there's nothing to the user that implies or confirms that it shouldn't work. Anthony -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DEV] RE: [VOTE][RFC] Coercive Scalar Type Hints
On Wed, 11 Mar 2015, Zeev Suraski wrote: From: Anthony Ferrara [mailto:ircmax...@gmail.com] function bar(float $x) $foo = 1; bar($foo); // will definitely fail in strict mode No, actually it won't fail in strict mode: https://wiki.php.net/rfc/scalar_type_hints_v5#integers_should_be_accepted _for_strict_float_arguments You're right, sorry. Reverse it then: function bar(int $x) $foo = 1.0; bar($foo); // will definitely fail in strict mode And it should fail, as logically it is the same as: $foo = 1.901 - 0.709 - 0.192; bar($foo); which is only 1, if you look at it with a small enough precision. cheers, Derick -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DEV] RE: [VOTE][RFC] Coercive Scalar Type Hints
-Original Message- From: Derick Rethans [mailto:der...@php.net] Sent: Wednesday, March 11, 2015 10:37 PM To: Zeev Suraski Cc: Anthony Ferrara; internals@lists.php.net Subject: RE: [PHP-DEV] RE: [VOTE][RFC] Coercive Scalar Type Hints You're right, sorry. Reverse it then: function bar(int $x) $foo = 1.0; bar($foo); // will definitely fail in strict mode And it should fail, as logically it is the same as: $foo = 1.901 - 0.709 - 0.192; bar($foo); which is only 1, if you look at it with a small enough precision. I'm not sure what you're trying to say. The two pieces are indeed identical from all points of view - static analysis, how it would behave in strict type hinting, weak type hinting or coercive type hinting. Zeev -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DEV] Re: [VOTE][RFC] Coercive Scalar Type Hints
It was actually Anthony who proposed that I do that. He also proposed that if they both pass, we'll have a vote to choose between them. For a lot of people, the dual mode and coercive STH RFCs aren't a zero sum game. They just want ONE of them to pass to have some sort of scalar type hinting, and almost don't care what it is. These people should vote in favor of both RFCs, if they find both of them acceptable. Rest assured that if I see that they both seem to be failing as we near the end of the voting time, I'll retract the Coercive STH RFC - and I'll actually vote in favor of the dual mode RFC, as much as I think it's bad, so that we have SOME sort of scalar type hinting in 7. Zeev -Original Message- From: Benoit Schildnecht [mailto:bensor...@neuf.fr] Sent: Wednesday, March 11, 2015 8:37 PM To: internals@lists.php.net Subject: [PHP-DEV] Re: [VOTE][RFC] Coercive Scalar Type Hints Hi, You are making a very huge mistake, IMHO. By having 2 conflicting RFC, you are taking the risk they both fail. And it won't do any good to the language. While you could have either proposed yours after the STH one if it would have failed, or create a new RFC to make the STH one evolve if it would have succeeded, you decided to act with precipitation. Why did you do this ? I'm kinda sad, upset and anxious. Regards, Zeev Suraski a écrit dans le message de groupe de discussion : The vote on the Coercive Scalar Type Hints is now open for voting. The latest version of the RFC includes changes discussed on internals@ last week: 1. Accept string-bool and int-bool conversions (false-bool is not supported) 2. Accept leading/trailing spaces in string-number conversions. wiki.php.net/rfc/coercive_sth wiki.php.net/rfc/coercive_sth#vote Thanks! Zeev -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] RE: [VOTE][RFC] Coercive Scalar Type Hints
Zeev, You also stated above that false-bool is not supported (I'm guessing you meant float-bool). So users would be able to pass 4.3 to a bool typehint, but not 4.3? This behavior seems very arbitrary and confusing. It may be confusing, but only academically so. Again, this approach tries to work well with real world usage - and reject conversions which are likely to be erroneous. 4.3 may look like a floating point number but in the context of conversion to boolean, that doesn't matter much. It's a string. Doesn't that contradict what you've been saying the whole time about how 13 and 13 and 13.0 are really the same thing, and as such should be coerced? function bar(float $x) $foo = 1; bar($foo); // will definitely fail in strict mode No, actually it won't fail in strict mode: https://wiki.php.net/rfc/scalar_type_hints_v5#integers_should_be_accepted_for_strict_float_arguments Anthony -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: [VOTE][RFC] Coercive Scalar Type Hints
On 11 March 2015 at 18:46, Eli e...@eliw.com wrote: Benoit ... actually Anthony's original proposal specifically was designed to be live at the same time as this alternative proposal. And it's even mentioned in the proposal (stating that it would stay open until the 13th or when the alternative proposal voting ended - whichever was later) So this was all 'as planned' there, Eli Not sure designed to be live at the same time is entirely correct. It's more of an honour clause to be invoked in the event of unfortunate circumstances. (With the less honourable option being to lock in all of the votes and declaring ergo sum victor) -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: [VOTE][RFC] Coercive Scalar Type Hints
Benoit ... actually Anthony's original proposal specifically was designed to be live at the same time as this alternative proposal. And it's even mentioned in the proposal (stating that it would stay open until the 13th or when the alternative proposal voting ended - whichever was later) So this was all 'as planned' there, Eli On 3/11/15 2:37 PM, Benoit Schildnecht wrote: Hi, You are making a very huge mistake, IMHO. By having 2 conflicting RFC, you are taking the risk they both fail. And it won't do any good to the language. While you could have either proposed yours after the STH one if it would have failed, or create a new RFC to make the STH one evolve if it would have succeeded, you decided to act with precipitation. Why did you do this ? I'm kinda sad, upset and anxious. Regards, Zeev Suraski a écrit dans le message de groupe de discussion : The vote on the Coercive Scalar Type Hints is now open for voting. The latest version of the RFC includes changes discussed on internals@ last week: 1. Accept string-bool and int-bool conversions (false-bool is not supported) 2. Accept leading/trailing spaces in string-number conversions. wiki.php.net/rfc/coercive_sth wiki.php.net/rfc/coercive_sth#vote Thanks! Zeev -- | Eli White | http://eliw.com/ | Twitter: EliW | signature.asc Description: OpenPGP digital signature
RE: [PHP-DEV] RE: [VOTE][RFC] Coercive Scalar Type Hints
-Original Message- From: Anthony Ferrara [mailto:ircmax...@gmail.com] Sent: Wednesday, March 11, 2015 8:28 PM To: Zeev Suraski Cc: Theodore Brown; internals@lists.php.net Subject: Re: [PHP-DEV] RE: [VOTE][RFC] Coercive Scalar Type Hints Zeev, You also stated above that false-bool is not supported (I'm guessing you meant float-bool). So users would be able to pass 4.3 to a bool typehint, but not 4.3? This behavior seems very arbitrary and confusing. It may be confusing, but only academically so. Again, this approach tries to work well with real world usage - and reject conversions which are likely to be erroneous. 4.3 may look like a floating point number but in the context of conversion to boolean, that doesn't matter much. It's a string. Doesn't that contradict what you've been saying the whole time about how 13 and 13 and 13.0 are really the same thing, and as such should be coerced? No, it does not. 13 and 13 and 13.0 are the same thing when you're expecting an integer, and rejecting 13 as an integer is nothing but noise in the vast majority of cases - noise that will push towards an explicit cast. Strings, however, are treated in a totally different way that places zero meaning on their numeric value across the entirety of PHP when in the context of a boolean. function bar(float $x) $foo = 1; bar($foo); // will definitely fail in strict mode No, actually it won't fail in strict mode: https://wiki.php.net/rfc/scalar_type_hints_v5#integers_should_be_accepted _for_strict_float_arguments You're right, sorry. Reverse it then: function bar(int $x) $foo = 1.0; bar($foo); // will definitely fail in strict mode Zeev -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php