Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:23918 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 386 invoked by uid 1010); 4 Jun 2006 11:52:48 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 371 invoked from network); 4 Jun 2006 11:52:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jun 2006 11:52:48 -0000 X-Host-Fingerprint: 217.79.190.163 r163.red.fastwebserver.de Received: from ([217.79.190.163:24791] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 43/D2-49656-F89C2844 for ; Sun, 04 Jun 2006 07:52:47 -0400 To: internals@lists.php.net,Marcus Boerger Date: Sun, 4 Jun 2006 13:52:41 +0200 Message-ID: <20060604135241.3beacb32@pierre-u64> In-Reply-To: <64299052.20060604120852@marcus-boerger.de> 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> <64299052.20060604120852@marcus-boerger.de> 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) Hello, > Hello Rasmus, Andi, > marcus@zaphod /usr/src/PHP_5_2 $ php -r 'var_dump(spl_object_hash(new > stdClass));' string(32) "0bab1548e3b42acbcf1170617b5432ae" > > For PHP 5.2 we could think about adding a hash handler to the object > handler table and provide the above as default implementation. That > hash handler would then be called when an object is being used as an > offset. Maybe later in PHP 6 we can also add an interface that allows > to overload that hash implementation. (If someone really wants that). > Yet anything the user can overload be it an interface or magic > function (e.g. __hashOf) seems to be too much for now. Do you mean to allow object as indices with this default implementation? But this implementataion cannot be overloaded? I fail to see the needs of such things in 5.x (or 6.x even with overload). Adding another magic method __toHash is also not what I would like. Adding a function hash_from_object() or spl_hash_from object() to ease the generations of hashes is indeed a good idea. There is no impact in the objects managements and people are free to use it or not (no magic default behaviors). --Pierre