Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49837 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97659 invoked from network); 1 Oct 2010 09:39:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Oct 2010 09:39:00 -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.170 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.170 mail-wy0-f170.google.com Received: from [74.125.82.170] ([74.125.82.170:47000] helo=mail-wy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7A/8B-18648-03CA5AC4 for ; Fri, 01 Oct 2010 05:38:57 -0400 Received: by wyb33 with SMTP id 33so481416wyb.29 for ; Fri, 01 Oct 2010 02:38:53 -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 :content-transfer-encoding; bh=US3A8G+wkYQbSgrmkNK5kO4uNtYRHgWlPR3v0bZzDKY=; b=dfU6w6bw00BboHMBDbIVIa5ZPyWpc2ZU9ERueGXYllGYHQc8XfzSXszDJTpjNDOCzv lZdi80VuO5a3wBE4lzRlhXuIT3DUq0SNjs0QqvzYlEcY6YaHVg7vVzaDTqhg3eGIyIX0 OTxXzlfF35UynNWPUJlxfheu26CbQbEhbuMzU= 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:content-transfer-encoding; b=G3Xnk79DLAHVK3sPVvl55TpGdrG3AseAAJBDEYvY/xz14HzhEYEDs8gcS9YrMU9MMD ROGtOjEozjfCwg4yCAmC6FEvZ8pFPXsLbEVgSkP5gm39H+XxKISu2Emi1GKyNo1VFA2K WFKGZSspIZUwiz9PPriq6EETDItY4cDaiVWPg= MIME-Version: 1.0 Received: by 10.227.152.131 with SMTP id g3mr4409106wbw.108.1285925933246; Fri, 01 Oct 2010 02:38:53 -0700 (PDT) Received: by 10.227.130.164 with HTTP; Fri, 1 Oct 2010 02:38:53 -0700 (PDT) In-Reply-To: References: Date: Fri, 1 Oct 2010 11:38:53 +0200 Message-ID: To: Adam Harvey Cc: PHP internals Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Re: RFC: Comparable interface From: pierre.php@gmail.com (Pierre Joye) hi Adam, Thanks for writing and updating a RFC, always the best way to propose new features :) On Fri, Oct 1, 2010 at 10:38 AM, Adam Harvey wrote: > On 30 September 2010 21:33, Adam Harvey wrote: >> I've just written an RFC (with a patch against trunk) to implement a >> Comparable interface similar to that in Java =97 in effect, allowing >> object instances to be compared with semantics defined in userspace. >> This is admittedly at the lower end of RFC-worthy proposals, but it's >> a good system, and I'd like to see it used a little more. Plus, it's >> good practice for the more interesting stuff to come. :) > > I've updated the RFC with a fresh patch that doesn't involve SPL at > all and attempted to incorporate some of the questions and answers so > far into the RFC. I've also added a section for concerns with the RFC; > I've attempted to distil the concerns I've seen so far, but please > feel free to edit that list if specific concerns are misrepresented or > unrepresented. Maybe to get a context about how other languages work (or do not work) with these similar features, it could be interesting to look at the python (2.5) documentation: http://docs.python.org/release/2.5.2/ref/customization.html As I would be in favor of having a compareTo interface for similar objects, I worry a bit about comparing apple and pear. Yes, an apple can be greater than a pear in real world but the wtf is somehow huge in a php context. That's why I share Stas or Gustavo thoughts about comparing instances of different classes (or with inheritance from internal classes without a comparable implementation). To be more precised, by "wtf", I mean that $a =3D=3D $b may not mean that $b =3D=3D $a (as in python for example). That's something we should consider carefully. Cheers, --=20 Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org