Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96110 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29339 invoked from network); 23 Sep 2016 13:51:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Sep 2016 13:51:42 -0000 Authentication-Results: pb1.pair.com smtp.mail=cschneid@cschneid.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=cschneid@cschneid.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain cschneid.com from 195.226.6.51 cause and error) X-PHP-List-Original-Sender: cschneid@cschneid.com X-Host-Fingerprint: 195.226.6.51 darkcity.gna.ch Received: from [195.226.6.51] ([195.226.6.51:44040] helo=mail.gna.ch) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C8/A0-24472-D6335E75 for ; Fri, 23 Sep 2016 09:51:41 -0400 Received: from [10.183.1.94] (unknown [217.192.174.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by darkcity.gna.ch (Postfix) with ESMTPSA id 6C844B208B0; Fri, 23 Sep 2016 15:51:38 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.0 \(3226\)) In-Reply-To: Date: Fri, 23 Sep 2016 15:51:38 +0200 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <9F330826-CF44-4584-961B-727EEDD9482A@cschneid.com> References: To: Vesa Kaihlavirta X-Mailer: Apple Mail (2.3226) Subject: Re: [PHP-DEV] RFC: Strict comparisons From: cschneid@cschneid.com (Christian Schneider) 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. 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. 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 :-) 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. Regards, - Chris