Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49868 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7184 invoked from network); 5 Oct 2010 03:34:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Oct 2010 03:34:28 -0000 Authentication-Results: pb1.pair.com smtp.mail=ceo@l-i-e.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ceo@l-i-e.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain l-i-e.com designates 67.139.134.202 as permitted sender) X-PHP-List-Original-Sender: ceo@l-i-e.com X-Host-Fingerprint: 67.139.134.202 o2.hostbaby.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (2) Received: from [67.139.134.202] ([67.139.134.202:2628] helo=o2.hostbaby.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AD/EB-18530-3CC9AAC4 for ; Mon, 04 Oct 2010 23:34:28 -0400 Received: (qmail 68749 invoked by uid 98); 5 Oct 2010 03:34:31 -0000 Received: from localhost by o2.hostbaby.com (envelope-from , uid 1013) with qmail-scanner-2.05 ( Clear:RC:1(127.0.0.1):. Processed in 0.036435 secs); 05 Oct 2010 03:34:31 -0000 Received: from localhost (HELO www.l-i-e.com) (127.0.0.1) by localhost with SMTP; 5 Oct 2010 03:34:31 -0000 Received: from webmail (SquirrelMail authenticated user ceo@l-i-e.com) by www.l-i-e.com with HTTP; Mon, 4 Oct 2010 22:34:31 -0500 Message-ID: <21ee4c54b86da736b838b5d5580b299a.squirrel@www.l-i-e.com> In-Reply-To: <4CA90F4C.609@sugarcrm.com> References: <1285856641.16846.92.camel@guybrush> <1286115365.2606.302.camel@guybrush> <1286116661.2606.313.camel@guybrush> <4CA90F4C.609@sugarcrm.com> Date: Mon, 4 Oct 2010 22:34:31 -0500 To: internals@lists.php.net User-Agent: SquirrelMail/1.4.21 [SVN] MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Subject: Re: [PHP-DEV] RFC: Comparable interface From: ceo@l-i-e.com ("Richard Lynch") On Sun, October 3, 2010 6:18 pm, Stas Malyshev wrote: >> $a = new stdclass; >> $a->prop = null; >> $b = new stdclass; >> $b->prop2 = null; >> >> var_dump($a> $b); //false >> var_dump($a == $b); //false >> var_dump($b> $a); //false > > That's because there's no total ordering of generic objects that can > make sense. Only very specific objects - such as ones representing > numeric qualities or having numeric properties - can be ordered, most > of > objects are unordered. And comparing objects with scalars > automagically > might bring a lot of surprises as nobody really expects $a == $b and > $b > == $a to be different now. If you make == not reflexive, I'd be pretty cranky... :-) HOWEVER, here's an idea from left field... If PHP is comparing OBJECTS and cannot discern an ordering, perhaps returning NULL instead of FALSE would make sense. I have NO IDEA if this is do-able, sensible, or reasonable... It just struck me that when PHP doesn't "know" $a < $b should be TRUE/FALSE, returning NULL instead would be a "reasonable" course of action, from this naive scripter's POV. -- brain cancer update: http://richardlynch.blogspot.com/search/label/brain%20tumor Donate: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FS9NLTNEEKWBE