Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82112 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2235 invoked from network); 8 Feb 2015 04:33:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Feb 2015 04:33:07 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.48 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.216.48 mail-qa0-f48.google.com Received: from [209.85.216.48] ([209.85.216.48:54730] helo=mail-qa0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 13/25-07765-207E6D45 for ; Sat, 07 Feb 2015 23:33:06 -0500 Received: by mail-qa0-f48.google.com with SMTP id v8so16623762qal.7 for ; Sat, 07 Feb 2015 20:33:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Jq4ot00V8zqXzWXAevZ9LAwsaANq8gXPEj5FJZZHH0w=; b=EdyAgfgbGefnF9GFVpg/ZdrnzTaio4RnbHCpe8uiI9gE7XfGRbT60WuvQvCxOvXXZG zrITgBM2TZTtH+5Aa6cqpbtqCtiUAPFTCn1Aw2c3x++VeT9m5esy/7on1T3Oti9ppakm QM7mdohpq0Kt26XMorJ86lzm58QHfk832e2WUA2PNoa4K1Upjf+71Va/CAak5x2b5ipr it2+NNSNumUx+X0hPaCcliC56+Eulguy1kOJkm6p1ChQx9MYnx8JytlLOhHnYX18UReS q7YKeqpJ6o8gh12ITRGMPUW1XWIL3d7x/B29reC5bn0anU160knlcQtuf5sSqbcq5MOQ nzgQ== MIME-Version: 1.0 X-Received: by 10.140.85.211 with SMTP id n77mr12942605qgd.17.1423369983512; Sat, 07 Feb 2015 20:33:03 -0800 (PST) Received: by 10.96.185.37 with HTTP; Sat, 7 Feb 2015 20:33:03 -0800 (PST) Received: by 10.96.185.37 with HTTP; Sat, 7 Feb 2015 20:33:03 -0800 (PST) In-Reply-To: <54D6DD7E.5060602@lerdorf.com> References: <8703B53E-2C4A-4AC6-95C4-D4F19C6D5221@ajf.me> <9E1C2427-0295-4F3E-BD29-04DA84321067@ajf.me> <54D6CC39.50708@lerdorf.com> <93AAEA55-1C03-46AD-88D0-6A2F5531FCA6@ajf.me> <54D6DD7E.5060602@lerdorf.com> Date: Sun, 8 Feb 2015 11:33:03 +0700 Message-ID: To: Rasmus Lerdorf Cc: PHP internals , Andrea Faulds , =?UTF-8?Q?Pavel_Kou=C5=99il?= Content-Type: multipart/alternative; boundary=001a11c151fa40581c050e8c2663 Subject: Re: [PHP-DEV] [VOTE] Scalar Type Hints From: pierre.php@gmail.com (Pierre Joye) --001a11c151fa40581c050e8c2663 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Feb 8, 2015 10:52 AM, "Rasmus Lerdorf" wrote: > > On 02/07/2015 09:51 PM, Andrea Faulds wrote: > >> tan(1); > >> echo strstr("test", "est", 1); > > > > Banning int->float and float->int is both a pain point and sometimes a life-saver. It=E2=80=99s annoying that tan(1) doesn=E2=80=99t work. On the = other hand, you discover if your ints floats would be silently truncated (as I did with PictoSwap). > > > > I wouldn=E2=80=99t say that int->string not working is a problem, thoug= h. Seeing something like strstr(=E2=80=9Ctest=E2=80=9D, =E2=80=9Cest=E2=80=9D,= 1); is rather confusing. Looking at it, I=E2=80=99d think the third parameter is some sort of number= for you to want to pass an integer to it. If I want a string, I=E2=80=99ll use one. > > This isn't int->string. This is int->boolean. The 3rd arg to strstr() is > a boolean and passing 1 instead of true makes it blow up. It is very > very common for people to pass 0 or 1 in place of true/false to all > sorts of things in PHP. > > > Yes, the RFC is somewhat inaccurate in that respect. It is per-file in one sense (like encoding, but unlike ticks, it has no effect on the including or included files). However, it technically affects the remainder of the file, not the whole file. > > Well, no, not the remainder of the file either since it can be switched > again. It only affects the part of the file between declares if there is > a second one. For this specific weirdness it should really be fixed somehow, like for namespace. It has to be used at the top of a file. As it is a compile time thing, the extra check should not have much impact. --001a11c151fa40581c050e8c2663--