Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82113 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4123 invoked from network); 8 Feb 2015 04:38:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Feb 2015 04:38:38 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.199 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.199 imap11-2.ox.privateemail.com Received: from [192.64.116.199] ([192.64.116.199:34884] helo=imap11-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DB/75-07765-A48E6D45 for ; Sat, 07 Feb 2015 23:38:37 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 32AB18800E5; Sat, 7 Feb 2015 23:38:31 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap11.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap11.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 9hOcNEKnl2U7; Sat, 7 Feb 2015 23:38:31 -0500 (EST) Received: from oa-res-26-240.wireless.abdn.ac.uk (oa-res-26-240.wireless.abdn.ac.uk [137.50.26.240]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 5D7A98800A2; Sat, 7 Feb 2015 23:38:30 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) In-Reply-To: <54D6DD7E.5060602@lerdorf.com> Date: Sun, 8 Feb 2015 04:38:27 +0000 Cc: =?utf-8?Q?Pavel_Kou=C5=99il?= , PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: <006E6DC4-290F-473F-BFB5-E8D52B205B0D@ajf.me> 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> To: Rasmus Lerdorf X-Mailer: Apple Mail (2.2070.6) Subject: Re: [PHP-DEV] [VOTE] Scalar Type Hints From: ajf@ajf.me (Andrea Faulds) Hi, > On 8 Feb 2015, at 03:52, Rasmus Lerdorf wrote: >=20 > On 02/07/2015 09:51 PM, Andrea Faulds wrote: >>> tan(1); >>> echo strstr("test", "est", 1); >>=20 >> 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). >>=20 >> I wouldn=E2=80=99t say that int->string not working is a problem, = though. 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. >=20 > 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. Oh, my bad, I looked up strtr and not strstr. I=E2=80=99m not sure that disallowing implicit integer->boolean = conversion is bad, though. That conversion will discard all data except = whether the value is non-zero. If you opt in to strict typing, then you = have chosen to always use the correct types. >=20 >> 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. >=20 > 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. Sure, that=E2=80=99s true, the option can be changed more than once. -- Andrea Faulds http://ajf.me/