Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85026 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73059 invoked from network); 16 Mar 2015 11:32:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Mar 2015 11:32:52 -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 74.125.82.51 as permitted sender) X-PHP-List-Original-Sender: xinchen.h@zend.com X-Host-Fingerprint: 74.125.82.51 mail-wg0-f51.google.com Received: from [74.125.82.51] ([74.125.82.51:33932] helo=mail-wg0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B1/B0-03331-06FB6055 for ; Mon, 16 Mar 2015 06:32:49 -0500 Received: by wggv3 with SMTP id v3so37251317wgg.1 for ; Mon, 16 Mar 2015 04:32:45 -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=hWK0RaYdCGnitBsqg3GtoG1HCHx0NDb6SBltOTfWLvQ=; b=jGLViWwy2fIpaKgeDY5lzB3IRvFFdUxAR8J5IGdavLaN2WTsG/rSI1N7AkDMFU+pUm qMSO8LA+tx4suDrtVA9oxGoBSt1Ozwoi6xqo101gypTb1Wo4gYpZs4H5N+Dp7uFGJ3QK wimr2VMX73p3tAOrGDWeyt+w5iHXLuPZ4k7ORJbU5Zx9IqoFjLyGjW15ebGAfVvXIllI hgyD633sDfRRi6oentAws5oV9b7lLjeP0kwJpEeqQ8Ejozaka3NU2T/0vEx6yaijLZmw eHzcDOBNal5WC2/h5ygIa5D96o/Dr+6kcEFA4kbTgd7CktijKC1caRxnyLl5QlXYgRpe DOsQ== X-Gm-Message-State: ALoCoQlVG29Bb8fxsZUiTfvpAbS5LvJaNWN4kDw6mexrWjBWgDPOpvz+D6vMWlfvJ8TrP/MOi/SzGC84P98uZG7iZqOMzdkYlCOMzL7n2GCJOnzq/s9zpa+vp/oTz21+cNNUPYS9J2om3IFhPM4BsROQbCNQLMkZmg== X-Received: by 10.194.87.100 with SMTP id w4mr118310930wjz.65.1426505565411; Mon, 16 Mar 2015 04:32:45 -0700 (PDT) Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com. [209.85.212.180]) by mx.google.com with ESMTPSA id ei3sm14958417wib.4.2015.03.16.04.32.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Mar 2015 04:32:44 -0700 (PDT) Received: by wibg7 with SMTP id g7so35054829wib.1 for ; Mon, 16 Mar 2015 04:32:43 -0700 (PDT) X-Received: by 10.152.116.65 with SMTP id ju1mr35079206lab.32.1426505563602; Mon, 16 Mar 2015 04:32:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.114.82.99 with HTTP; Mon, 16 Mar 2015 04:32:23 -0700 (PDT) In-Reply-To: References: Date: Mon, 16 Mar 2015 19:32:23 +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) 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 wrot= e: >> > >> > 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 RF= C), 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.. 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 --=20 Xinchen Hui @Laruence http://www.laruence.com/