Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:23895 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 22235 invoked by uid 1010); 3 Jun 2006 23:54:06 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 22219 invoked from network); 3 Jun 2006 23:54:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jun 2006 23:54:05 -0000 X-PHP-List-Original-Sender: gwynne@skytag.com X-Host-Fingerprint: 208.97.132.53 ip-208-97-132-53.dreamhost.com Linux 2.4/2.6 Received: from ([208.97.132.53:37196] helo=spunkymail-a12.dreamhost.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 51/83-49656-D1122844 for ; Sat, 03 Jun 2006 19:54:05 -0400 Received: from [192.168.1.104] (c-24-147-151-210.hsd1.ma.comcast.net [24.147.151.210]) by spunkymail-a12.dreamhost.com (Postfix) with ESMTP id 231E67FA0 for ; Sat, 3 Jun 2006 16:54:02 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v749.3) In-Reply-To: <4482094E.3000002@album.co.nz> References: <795156743.20060603134212@marcus-boerger.de> <18CE805D-C032-4B64-950A-119E46287AF5@prohost.org> <4481B92E.2030802@lerdorf.com> <4481C354.10207@lerdorf.com> <4AC4FA24-6E74-492A-A3CF-DD75CF26390C@skytag.com> <4482094E.3000002@album.co.nz> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-ID: <42D91ACE-7BC6-414C-92ED-EC6D28F1530F@skytag.com> Content-Transfer-Encoding: 7bit Date: Sat, 3 Jun 2006 19:54:00 -0400 To: internals@lists.php.net X-Mailer: Apple Mail (2.749.3) Subject: Re: [PHP-DEV] Missing __toString() part From: gwynne@skytag.com (Gwynne) On Jun 3, 2006, at 6:12 PM, Jasper Bryant-Greene wrote: > I would imagine that __hash() or whatever it is called would be > defined > on all objects and implemented internally in PHP, and would simply > generate some internal hash that is unique for all objects. That might work for initial testing, but applying that sort of hash function to objects identified purely by strings, to take one example, doesn't work. (in_array(new Str("A"), array(new Str("A"))) is one failure mode that comes instantly to mind. It's inevitable that two non-identical objects would contain identical data. Think of the reasons behind C++'s operator==, or for those of you familiar with Carbon programming under MacOS, the hash callbacks provided by CoreFoundation's various container types. Gwynne SkyTag Software