Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49852 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14510 invoked from network); 3 Oct 2010 18:02:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Oct 2010 18:02:31 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.54 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 74.125.82.54 mail-ww0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:52566] helo=mail-ww0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4B/54-22289-435C8AC4 for ; Sun, 03 Oct 2010 14:02:30 -0400 Received: by wwb13 with SMTP id 13so212785wwb.11 for ; Sun, 03 Oct 2010 11:02:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=tanoR8CALWp8tnC6j60+fqM5Z/MrKZc+2zp+mg5aOUQ=; b=H7vnoaEsDAvATd+whXFyu+Xv09l9jnJc/Nnfy+pML5pllHonwJfifMBjClybAurMnj 0mMR8Zg2xKr7sdOJ/ruJcHdztvz4rP179GRJTfzO9mxc9MC1omurSdGZF643WJvFQW83 9dcAMp9EI0qV5Ng5NUvgUibXKs4hYnlcFU5RI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=CpvJ+EhArdMyHz0HQgF953B2LfQ7Lp3IjNPbqhh8TpYEzmYsG3sZBbo207eC1O/Gc0 MWBWYsDSqxleIuUtROs7QMnAa4J/YNDcFvOqxixLGUtoGT6kXQ+ch7R/sNCp32B9lUn6 sT0owOWojijLF22DuH4oQS+IB4mRSQGE9iqkE= MIME-Version: 1.0 Received: by 10.227.69.202 with SMTP id a10mr7200542wbj.81.1286128933601; Sun, 03 Oct 2010 11:02:13 -0700 (PDT) Received: by 10.227.130.164 with HTTP; Sun, 3 Oct 2010 11:02:13 -0700 (PDT) In-Reply-To: References: <1285856641.16846.92.camel@guybrush> <1286115365.2606.302.camel@guybrush> <1286116661.2606.313.camel@guybrush> Date: Sun, 3 Oct 2010 20:02:13 +0200 Message-ID: To: Gustavo Lopes Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] RFC: Comparable interface From: pierre.php@gmail.com (Pierre Joye) hi Gustavo, On Sun, Oct 3, 2010 at 7:34 PM, Gustavo Lopes wrote: > You raise a fair point -- the motivation to override the comparison operator > for internal classes is indeed bigger because the state is not in the usual > places. However: > > * The functionality already exists; comparison operators already have their > meaning "changed" (read: user-defined) for some objects. > * I'd argue the current behavior (comparing classes and properties) is of > limited use for equality. It's common to lazy-load the properties of the > objects, which makes the current comparison behavior unreliable. > * 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 It may be why Stas' proposal could fit better, a comparable interface. As there is then no confusion with undefined and useless behaviors with normal comparison ops. Cheers, -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org