Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85029 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77676 invoked from network); 16 Mar 2015 11:40:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Mar 2015 11:40:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=xinchen.h@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=laruence@php.net; sender-id=unknown Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.215.54 as permitted sender) X-PHP-List-Original-Sender: xinchen.h@zend.com X-Host-Fingerprint: 209.85.215.54 mail-la0-f54.google.com Received: from [209.85.215.54] ([209.85.215.54:34762] helo=mail-la0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 57/B1-03331-611C6055 for ; Mon, 16 Mar 2015 06:40:09 -0500 Received: by lagg8 with SMTP id g8so36781889lag.1 for ; Mon, 16 Mar 2015 04:40:03 -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=QSsKJcQ3OTg8zut8ppeGuEvlewvNpT+gspxAErJqs4w=; b=KrcnmUIRGFfeMF1iEhX2zvsIFEeQF+orx3uOtMQWzM1hwmImDWD1z8BJr02lL0+Mmx 80Dt5rcjxg3Yo3veNXg9sZpcneYcJLzULW9S+coU5oTiGBG9iVet7kg4mzy9AN65OETF UlOw3JI4CAs27ZwQbUFsHdCaOQ+abr1yc3tVpdf7hddLlpnuyMquejO1My5YvioMn3Bi HTMt81Azc+dm3JiJZHtcq8WjjKtCBlc873KB+LoIHGYiwQlF4VavT4SUKGzc2QsgqlMm wOVjffIBS9ZFq7Wzxp6e9spCSE22aQJpvWewAw0mYVeu3MWfmFpGqSDWD+wWqW5gQYNQ c5mg== X-Gm-Message-State: ALoCoQm97J4ImaOr6rhX3fjuz4kZPSGWra6HN+yYtbU1YIx9pnVaH+0No3+g3DpVww2Cvx8II0wfMXLAULzCAbZDgz9CLmgGLsD+S04kN1r+O/kQWU9ToiFcMgWTZ4TKMGVWR1OMJKsVqL8IdmwUzWL2888OonqU1w== X-Received: by 10.152.9.98 with SMTP id y2mr54515159laa.94.1426506003702; Mon, 16 Mar 2015 04:40:03 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPSA id be13sm2136106lab.46.2015.03.16.04.40.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Mar 2015 04:40:02 -0700 (PDT) Received: by lagg8 with SMTP id g8so36780456lag.1 for ; Mon, 16 Mar 2015 04:40:01 -0700 (PDT) X-Received: by 10.152.36.138 with SMTP id q10mr54073296laj.113.1426506001746; Mon, 16 Mar 2015 04:40:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.114.82.99 with HTTP; Mon, 16 Mar 2015 04:39:41 -0700 (PDT) In-Reply-To: References: Date: Mon, 16 Mar 2015 19:39:41 +0800 Message-ID: To: Yasuo Ohgaki Cc: Derick Rethans , 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:33 PM, Yasuo Ohgaki wrote: > Hi Derick, > > On Mon, Mar 16, 2015 at 8:18 PM, Derick Rethans wrote: >> >> On Mon, 16 Mar 2015, Xinchen Hui wrote: >> >> > On Mon, Mar 16, 2015 at 5:00 PM, Pierre Joye >> > wrote: >> > > >> > > 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 >> 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". > > > Are you sure on your bet? > > lib.php: > declare(strict_types =3D 1); > function foo(int $a) { > // no function call here > } > ?> > The declare here does just nothing. > > a.php: > require "lib.php"; > foo("123"); // will work > ?> > > b.php: > declare(strict_types =3D 1); > require "lib.php"; > foo("123"); // will give an error > ?> > > This behavior is unacceptable. > Caller (a.php, b.php) must satisfy lib.php expectation to make lib.php > work as it should. Otherwise, all kinds of unexpected for lib.php and it'= s > users may happen. > > Regards, > > -- > Yasuo Ohgaki > yohgaki@ohgaki.net And last comment, if there no such declare thing, I will definitely vote yes to this RFC. that's why I want vote no for this, and wait for Bob's Basic STH. thanks > --=20 Xinchen Hui @Laruence http://www.laruence.com/