Re: RFC: Comparable interface
| From: | Richard Lynch | Date: | Tue, 05 Oct 2010 03:31:14 +0000 |
| Subject: | Re: RFC: Comparable interface | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-49867@lists.php.net to get a copy of this message | ||
On Sun, October 3, 2010 12:34 pm, Gustavo Lopes wrote:
> * The current behavior for >, <, etc. is completely useless. It's
> unpredictable and it doesn't even establish a total order:
>
> $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
Errrr.
Which one of these would you expect to be "true"?...
They're sure not equal, right?
And what would make $a or $b "greater" than the other? I mean, *WHY*
would you expect one of those to be "true", if you do expect one of
them to be "true"?
I sure can't find any logical a priori ordering, total, partial, or
otherwise.
Last time I checked, there was no "rule" that any set/graph or other
mathematical collection had to have a defined ordering, even partial.
But it's been ages since I got my Honors Math degree, so maybe they
changed the rule while I wasn't looking... :-)
--
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