Re: About declare(strict_types = 1)
| From: | Xinchen Hui | Date: | Mon, 16 Mar 2015 09:05:21 +0000 |
| Subject: | Re: About declare(strict_types = 1) | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-85009@lists.php.net to get a copy of this message | ||
Hey:
On Mon, Mar 16, 2015 at 5:00 PM, Pierre Joye <pierre.php@gmail.com> wrote:
> Hi,
>
> On Mar 16, 2015 4:29 PM, "Xinchen Hui" <laruence@php.net> wrote:
>>
>> Hey:
>>
>> The most unaccept feature in current STH thing(v.5.0) is this.
>>
>> acutaly, I believe in most applications, they will still keep this
>> off..
>>
>> so why we introduce such thing?
>>
>> beside this, I have a question, which is not explained in the RFC:
>>
>> lib.php
>> <?php
>> declare(strict_types = 1);
>> function add(int $a, int $b) {
>> }
>> ?>
>>
>> assuming lib.php is a thrid part library which I want to use it
>> in my project.
>>
>> but I use whole weak types in my project..
>>
>> thus I simply call add by:
>>
>> <?php
>>
>> add($_GET['a'], $_GET['b']); //recoverable error since all
>> input in _GET _POST is string by default
>>
>> ?>
>>
>> that means, I need to add a lots of (int) while I try to call a
>> function in a library which is not written by myself.
>>
>> is that right?
>
> You got the answer but one thing bothers me a lot right now.
>
> How did you vote against this rfc while missing the core point of it (after
> actually having a strict mode)?
as I said,
"
acutaly, I believe in most applications, they will still keep this off..
so why we introduce such thing?
"
I don't like strict_types at all..
the question I asked is just want one of my concern is not ture, or
not oversight by others.
thanks
--
Xinchen Hui
@Laruence
http://www.laruence.com/