Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:23892 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26928 invoked by uid 1010); 3 Jun 2006 17:13:59 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 26911 invoked from network); 3 Jun 2006 17:13:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jun 2006 17:13:59 -0000 X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 204.11.219.139 lerdorf.com Linux 2.5 (sometimes 2.4) (4) Received: from ([204.11.219.139:58070] helo=lerdorf.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 2A/E1-22639-753C1844 for ; Sat, 03 Jun 2006 13:13:59 -0400 Received: from [192.168.200.106] (c-24-6-5-134.hsd1.ca.comcast.net [24.6.5.134]) (authenticated bits=0) by lerdorf.com (8.13.6/8.13.6/Debian-1) with ESMTP id k53HDuZ4031172; Sat, 3 Jun 2006 10:13:56 -0700 Message-ID: <4481C354.10207@lerdorf.com> Date: Sat, 03 Jun 2006 10:13:56 -0700 User-Agent: Thunderbird 3.0a1 (Macintosh/20060414) MIME-Version: 1.0 To: Stanislav Malyshev CC: internals@lists.php.net References: <795156743.20060603134212@marcus-boerger.de> <18CE805D-C032-4B64-950A-119E46287AF5@prohost.org> <4481B92E.2030802@lerdorf.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Missing __toString() part From: rasmus@lerdorf.com (Rasmus Lerdorf) Stanislav Malyshev wrote: > RL>>I don't understand why using the object as an index would trigger a > RL>>__toString() call. PHP's array indices are not defined to be strings, > RL>>so I don't see this as being a string context use and thus > RL>>__toString() shouldn't be called. > > If so, what should be the actual key in the hash? I am sure we could come up with some sort of hashing mechanism that would uniquely identify an object. And perhaps even expose it to the user with a __hashOf(). But again, I am not sure we want to open up that can of worms. Like I said, I think this is the more correct approach and that we shouldn't try to use a magic __toString() call here to attempt to emulate this. -Rasmus