Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:23902 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49134 invoked by uid 1010); 4 Jun 2006 01:55:35 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 49118 invoked from network); 4 Jun 2006 01:55:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jun 2006 01:55:35 -0000 X-Host-Fingerprint: 217.79.190.163 r163.red.fastwebserver.de Received: from ([217.79.190.163:29512] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id C7/06-49656-69D32844 for ; Sat, 03 Jun 2006 21:55:34 -0400 To: internals@lists.php.net,rasmus@lerdorf.com (Rasmus Lerdorf) Date: Sun, 4 Jun 2006 03:55:31 +0200 Message-ID: <20060604035531.765e8583@pierre-u64> In-Reply-To: <44823C51.7040408@lerdorf.com> 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> <44823B41.5000608@akbkhome.com> <44823C51.7040408@lerdorf.com> Reply-To: pierre.php@gmail.com X-Newsreader: Sylpheed-Claws 2.1.1 (GTK+ 2.8.17; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Posted-By: 217.79.190.163 Subject: Re: [PHP-DEV] Missing __toString() part From: pierre.php@gmail.com (Pierre) On Sat, 03 Jun 2006 18:50:09 -0700 rasmus@lerdorf.com (Rasmus Lerdorf) wrote: > This works today and basically gives you the same thing. The only > thing it doesn't do is separate an array index context from an output > context allowing you do different things in the two cases. > > I think if we are going to add a toHash thing, it should trigger when > the object is used in a hash context, just like toString triggers > when it is used in a string context. Agreed. this is the only solution to limit undesired behaviors, if we add such magic method. As well as raising warnings when an object is used as hash without having this method defined. -- Pierre