Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96111 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39075 invoked from network); 23 Sep 2016 15:59:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Sep 2016 15:59:26 -0000 Authentication-Results: pb1.pair.com header.from=php-lists@koalephant.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=php-lists@koalephant.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain koalephant.com designates 206.123.115.54 as permitted sender) X-PHP-List-Original-Sender: php-lists@koalephant.com X-Host-Fingerprint: 206.123.115.54 mail1.25mail.st Received: from [206.123.115.54] ([206.123.115.54:54179] helo=mail1.25mail.st) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F8/32-24472-A5155E75 for ; Fri, 23 Sep 2016 11:59:23 -0400 Received: from [10.0.1.23] (unknown [183.89.46.196]) by mail1.25mail.st (Postfix) with ESMTPSA id A7E9D6065E; Fri, 23 Sep 2016 15:59:09 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) In-Reply-To: <9F330826-CF44-4584-961B-727EEDD9482A@cschneid.com> Date: Fri, 23 Sep 2016 22:59:04 +0700 Cc: Vesa Kaihlavirta , internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <50921841-5F6D-4EB6-9E94-8D32FA05C86F@koalephant.com> References: <9F330826-CF44-4584-961B-727EEDD9482A@cschneid.com> To: Christian Schneider X-Mailer: Apple Mail (2.3124) Subject: Re: [PHP-DEV] RFC: Strict comparisons From: php-lists@koalephant.com (Stephen Reay) I find the idea of making =E2=80=98=3D=3D=E2=80=98 which has always been = a loose comparison, have a new optional way to be =E2=80=98more = strict=E2=80=99 than =E2=80=98=3D=3D=3D=E2=80=98 to be quite odd. I would however love a way to have strict comparisons in a switch = statement. Cheers Stephen > On 23 Sep 2016, at 20:51, Christian Schneider = wrote: >=20 > Am 19.09.2016 um 15:04 schrieb Vesa Kaihlavirta : >> >=20 >> $two =3D "2"; >> if ($two > 1) { >> echo "This sorta works without strict_comparisons=3D1" . = PHP_EOL; >> } >>=20 >> ...would throw a TypeError exception after this change. >=20 > This sounds like a bad idea to me: Changing the language semantics of = something so basic as the comparison operators seems like asking for = trouble. One programmer will try to incorporate code from non-strict = parts into strict parts and possibly gets exceptions even though the = code works. Another programmer is puzzled about all the type casts (or = even try/catch constructs) when moving code the other way around. >=20 > On top of that: Making it a runtime-setting or file-wide declaration = seems like the most troublesome option. > Reminds me way too much of magic quotes :-) >=20 > Let's take a step back: If you want type-safety and your program is = more or less well-structured then type declarations on function = parameters should IMHO be more than sufficient. >=20 > Regards, > - Chris >=20 >=20 > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >=20