Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:23900 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45068 invoked by uid 1010); 4 Jun 2006 01:42:31 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 45052 invoked from network); 4 Jun 2006 01:42:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jun 2006 01:42:31 -0000 X-PHP-List-Original-Sender: alan@akbkhome.com X-Host-Fingerprint: 202.81.246.113 246-113.netfront.net Received: from ([202.81.246.113:38073] helo=akbkhome.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 7A/85-49656-68A32844 for ; Sat, 03 Jun 2006 21:42:30 -0400 Received: from [192.168.0.184] by akbkhome.com with esmtp (Exim 4.62) (envelope-from ) id 1FmhoU-0005vn-Di; Sun, 04 Jun 2006 09:53:59 +0800 Message-ID: <44823B41.5000608@akbkhome.com> Date: Sun, 04 Jun 2006 09:45:37 +0800 User-Agent: Mozilla Thunderbird 0.8 (X11/20040926) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Andi Gutmans CC: pierre.php@gmail.com, internals@lists.php.net References: <795156743.20060603134212@marcus-boerger.de> <20060603143639.GF5355@desario.homelinux.net> <509342741.20060603183859@marcus-boerger.de> <7.0.1.0.2.20060603175211.02208a50@zend.com> <20060604030100.1093d2f9@pierre-u64> <7.0.1.0.2.20060603181129.0396fc18@zend.com> In-Reply-To: <7.0.1.0.2.20060603181129.0396fc18@zend.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-ACL-Warn: "cleared badlog" Subject: Re: [PHP-DEV] Missing __toString() part From: alan@akbkhome.com (Alan Knowles) $x = new Obj; $y[$x]= 123; That behaviour is going to be fun to document, and for people unfamilar with it to find in the manual -> php.net/array -> go to array syntax page -> read down to find about objects as keys -> go to __toHash() page... ..whereas... $x = new Obj; $y[$x->toHash()]= 123; they might have a chance to see instantly how that is supposed to work, on the rare occasion that somebody needs this, is it really worth building it into the langauge???? Regards Alan Andi Gutmans wrote: > Yep that is also a choice, although it can be advantageous to have an > automatic (a) which people just now works, always... > I don't think it's a critical problem because as you pointed out > people can deal with it, but I think it'd be nice to provide some > tools to make life easier. > > > At 06:01 PM 6/3/2006, Pierre wrote: > >> Hi, >> >> On 6/4/06, Andi Gutmans wrote: >> > Generally I think it's a good thing to allow to use objects as array >> > indexes. There are really two ways of doing it: >> > a) Try and find a way to create unique ideas. >> > b) Support __toString() and leave it up to the author. >> >> I see a third choice, which I prefer: >> >> c) leave the choice to the user, he knows better what to do with his >> object (like implementing his own get(Hash|Key) method. >> >> >> --Pierre > >