Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70071 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96546 invoked from network); 10 Nov 2013 08:56:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Nov 2013 08:56:03 -0000 Authentication-Results: pb1.pair.com header.from=swhitemanlistens-software@cypressintegrated.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=swhitemanlistens-software@cypressintegrated.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain cypressintegrated.com designates 173.1.104.101 as permitted sender) X-PHP-List-Original-Sender: swhitemanlistens-software@cypressintegrated.com X-Host-Fingerprint: 173.1.104.101 rproxy2-b-iv.figureone.com Windows 2000 SP2+, XP SP1 (seldom 98 4.10.2222) Received: from [173.1.104.101] ([173.1.104.101:64463] helo=rproxy2-b-iv.figureone.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4A/82-14014-22A4F725 for ; Sun, 10 Nov 2013 03:56:02 -0500 Received: from localhost ([216.220.114.66]) by rproxy2-b-iv.figureone.com (Brand New Heavy v1.0) with ASMTP id VTN95459 for ; Sun, 10 Nov 2013 00:55:59 -0800 Date: Sun, 10 Nov 2013 03:55:53 -0500 Reply-To: Sanford Whiteman X-Priority: 3 (Normal) Message-ID: <416659913.20131110035553@cypressintegrated.com> To: Yasuo Ohgaki In-Reply-To: References: <527DF228.1080108@sugarcrm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Comparison and conversion inconsistency - need more info From: swhitemanlistens-software@cypressintegrated.com (Sanford Whiteman) > min() behavior is nonsense and it would be good fixing min() at some > point. Not many users will be affected, IMO. Seriously, "O" isn't how one should decide to make such a fundamental change to PHP... Anyway, like Stas, I don't really understand the assumptions and conclusions you draw in bug #53104. You claim "Comparison operators evaluate comparison as PHP users expect, but min() does not. This behavior is not intuitive." (Though you didn't cite any expect/intuit statistics.) Your example is: ( -1 > NULL ) // bool(true) ( -1 < NULL) // bool(false) min(-1,NULL)) // NULL Yet these examples are entirely consistent once you accept that the comparison operator must (in PHP) return a boolean, while min() can have a dynamic return type and value. (Contrast this with SQL, in which a comparison may return NULL. If we needed to defensively code in PHP for simple operators to return NULL, we'd then need to make constant use of COALESCE-type wrappers in PHP. This is a dangerous slope.) Not to mention that they are consistent with the docs. To me, inconsistent would be: ( -1 > NULL ) // bool(false) ( -1 < NULL) // bool(true) min(-1,NULL)) // NULL If you had that, you'd have a smoking gun. -- Sandy