Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85028 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74923 invoked from network); 16 Mar 2015 11:34:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Mar 2015 11:34:03 -0000 Authentication-Results: pb1.pair.com header.from=laruence@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=xinchen.h@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.212.175 as permitted sender) X-PHP-List-Original-Sender: xinchen.h@zend.com X-Host-Fingerprint: 209.85.212.175 mail-wi0-f175.google.com Received: from [209.85.212.175] ([209.85.212.175:37992] helo=mail-wi0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0C/11-03331-BAFB6055 for ; Mon, 16 Mar 2015 06:34:03 -0500 Received: by wifj2 with SMTP id j2so40678199wif.1 for ; Mon, 16 Mar 2015 04:34:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=mmEMj/6HggUhB6ngC7MbRSmrPKiYekQVwYAtTi2iAm8=; b=FIcf6jZYTh7q5dTpV+f+LkV/0QReFrd5xngDXVuzZoZKWXS0qQmwjMiq879QuvtFK+ HAiZTr+W7Sc9IvqNBUtN9kcKnyCYZu9B8Mkyw1ufiAC5dCVFo7Ut6DWiV7dXkwJ6WClz Cl5YoI39oFEAojfoLxrWRfypO7O+9zocGFKnId23JF/+A4vwS1xAohRsPeDIRcvHuNav ro8RPO4N7cFLPzYFDlPOSkAeNNDal6csM4ZTwpoOi8Hfa2/9GI1fl8UapdnDYX+hXCPR lfW4q57MRZY/dH+EdsUGcEmTaG7eaeMxX4Fkv6hAQC+EeKa+pz1oHxr3Pb3QUGQhMNLr 6vbg== X-Gm-Message-State: ALoCoQm0DoIUU7koyOKIFA1T+XZH4To6L8PORNn0+OoYJ6bwVMYhS5RNW2TJQvZyYwpqBZG2tCzgYPkREt/oie5SRSaV6R1tTwHAHSnRzdc4jhZykyimDpS0dOPki0wlrItRYpVSPMt6MbK70215TsPf5chvgPyVmw== X-Received: by 10.180.75.167 with SMTP id d7mr40698992wiw.63.1426505640277; Mon, 16 Mar 2015 04:34:00 -0700 (PDT) Received: from mail-wg0-f41.google.com (mail-wg0-f41.google.com. [74.125.82.41]) by mx.google.com with ESMTPSA id fs8sm14954571wib.8.2015.03.16.04.33.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Mar 2015 04:33:59 -0700 (PDT) Received: by wgra20 with SMTP id a20so37310555wgr.3 for ; Mon, 16 Mar 2015 04:33:58 -0700 (PDT) X-Received: by 10.112.141.168 with SMTP id rp8mr28395787lbb.46.1426505638866; Mon, 16 Mar 2015 04:33:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.114.82.99 with HTTP; Mon, 16 Mar 2015 04:33:38 -0700 (PDT) In-Reply-To: References: Date: Mon, 16 Mar 2015 19:33:38 +0800 Message-ID: To: Derick Rethans Cc: Pierre Joye , PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] About declare(strict_types = 1) From: laruence@php.net (Xinchen Hui) On Mon, Mar 16, 2015 at 7:32 PM, Xinchen Hui wrote: > Hey: > > On Mon, Mar 16, 2015 at 7:18 PM, Derick Rethans wrote: >> On Mon, 16 Mar 2015, Xinchen Hui wrote: >> >>> On Mon, Mar 16, 2015 at 5:00 PM, Pierre Joye wro= te: >>> > >>> > On Mar 16, 2015 4:29 PM, "Xinchen Hui" 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 =E2=80=94 both weak (mode 1 of the STHv5 R= FC), 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/ --=20 Xinchen Hui @Laruence http://www.laruence.com/