Re: About declare(strict_types = 1)
| From: | Xinchen Hui | Date: | Mon, 16 Mar 2015 11:33:38 +0000 |
| Subject: | Re: About declare(strict_types = 1) | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-85028@lists.php.net to get a copy of this message | ||
On Mon, Mar 16, 2015 at 7:32 PM, Xinchen Hui <laruence@php.net> wrote:
> Hey:
>
> On Mon, Mar 16, 2015 at 7:18 PM, Derick Rethans <derick@php.net> wrote:
>> On Mon, 16 Mar 2015, Xinchen Hui wrote:
>>
>>> On Mon, Mar 16, 2015 at 5:00 PM, Pierre Joye <pierre.php@gmail.com> wrote:
>>> >
>>> > On Mar 16, 2015 4:29 PM, "Xinchen Hui" <laruence@php.net> wrote:
>>> >>
>>> >> 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..
>>
>> To be frank, I don't think "I don't like this" is a terribly good
>> reason
>> to vote against (or for something). What is important is how many people
>> would actually benefit from a feature, without it causing issues for
>> others. I am certainly no fan of the "declare" *syntax*, but I do know,
>> from talking at conferences that many many developers would like to see
>> scalar type hints in some way — both weak (mode 1 of the STHv5 RFC), and
> I think they just want a weak type hintings(PHP is a weak type
> language).. not strict types.
>
> especially not a dual mode, switch on/off by a declare line..
>
> it looks so ugly to me..
>
>> strict (mode 2). It even caters for people that don't want to use them
>> at all, as they can simply not use them. I also know, that without a
>> dual mode, it seems very unlikely for scalar type hints to make it
>> into PHP 7, and I don't think that is what users want. As this is our
>> *best* bet, I can only vote "yes".
> I understand your choice, but for me, as a six year PHP user. I can
> see how strict types can benifit me..
can not
>
> the only usage I can image is, turn on it in developer env to clean
> types passing, and turn off in produce env for safety(in case I forget
> to cast some types from $_GET $_POST).
>
> which is definitlely can be done by a extension, or hook..
>
> thanks
>>
>> cheers,
>> Derick
>
>
>
> --
> Xinchen Hui
> @Laruence
> http://www.laruence.com/
--
Xinchen Hui
@Laruence
http://www.laruence.com/