On Mar 16, 2015 1:17 PM, "Yasuo Ohgaki" <yohg...@ohgaki.net> wrote:
>
> Hi Pierre,
>
> On Mon, Mar 16, 2015 at 10:48 AM, Pierre Joye <pierre....@gmail.com>
wrote:
>>
>> > Coercive type for general developers and strict type for library
developers
>> > will
>> > eliminate more type related bugs, more natural to average PHP users.
IMHO.
>>
>> And change casting rules, open a pandora box. And even worst, it is a
>> zero compromise RFC. Same as before, no need to discuss that any
>> longer.
>
>
> "The same way before" is going to cause problems, or hide problems at
least.
> As Zeev's patch revealed, people do mistakes and the patch helps to find
them.
>
> "The same as before" will just hide these hard to find bugs.

I am against changing how PHP behaves with casting and co, as it does for
years.

This is extremely dangerous.

>>
>>
>> > It's natural that we have different point of views, but we can easily
>> > understand/guess
>> > the consequence of the RFC. Weak mode is simply too weak to be useful.
>> > Strict mode will hide type bugs by errorless casts.
>>
>> Show me examples when something not in strict mode behave differently
>> and it will be fixed. But saying that is per se wrong and double
>> standard in regard of voting. Or why did you vote in favor of other
>> RFCs which obviously had or still have bugs?
>
>
> This code is an example that I posted in other thread.
>
> e.g.
> <?php
> function check_num_range(int $num) { if ($num < 0 || $num > 100)
trigger_error('Invalid range'); }
> // Somewhere far from function definition.
> $num = $GET['num'];
> // Somewhere far from $num definition.
> check_num_range($num); // Trying to check validity, int and range.
> echo 'You have '.$num. ' now <br />'; // But $num could have any string.
>                                                             //
"check_num_range((int)$num)" wouldn't help also.
> ?>
>
> Simple cast hides bugs, not eliminates type bugs.
> This is just an example and there are many cases that cast hides bugs in
real world codes.
>
>>
>> > I hope both you and Zeev work together to satisfy most needs because
>> > hiding bugs are not good thing to do.
>>
>> It does but I do not claim that there are no bug, every code has bugs
>> and they should be fixed.
>
>
> I'm not saying the proposed patch has bugs, but I'm saying it hides
"users' code bugs".
>
> Hiding hard to find bugs does not make much sense while there is the
proposal that finds it.
> What I'm trying to say is "Why don't we collaborate?". Let users fix bugs
at first, then
> introduce more strict type checks if it's needed. Coercive type and
strict type can co-exist
> together well, but weak type and strict type cannot.

This example is out of the scope of this rfc. As I said many times, you
want to make php more friendly and let users write better code, that's a
good thing. However changing by default how php behaves for decades is a no
go for me. It will create more issues than it solves.

Reply via email to