Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:23938 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88870 invoked by uid 1010); 4 Jun 2006 16:03:02 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 88855 invoked from network); 4 Jun 2006 16:03:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jun 2006 16:03:02 -0000 X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 80.74.107.235 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from ([80.74.107.235:50193] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id BF/3D-49656-53403844 for ; Sun, 04 Jun 2006 12:03:02 -0400 Received: (qmail 12935 invoked from network); 4 Jun 2006 16:02:33 -0000 Received: from shire.zend.office (10.1.2.160) by internal.zend.office with SMTP; 4 Jun 2006 16:02:33 -0000 Date: Sun, 4 Jun 2006 19:02:33 +0300 (IDT) X-X-Sender: frodo@shire.zend.office To: Marcus Boerger cc: Andi Gutmans , internals@lists.php.net In-Reply-To: <866332952.20060604175205@marcus-boerger.de> Message-ID: References: <795156743.20060603134212@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> <20060604135241.3beacb32@pierre-u64> <1853717276.20060604140317@marcus-boerger.de> <1912643046.20060604141822@marcus-boerger.de> <7.0.1.0.2.20060604071847.03b74850@zend.com> <1834492302.20060604165624@marcus-boerger.de> <7.0.1.0.2.20060604075725.03d77b20@zend.com> <1996647038.20060604170829@marcus-boerger.de> <7.0.1.0.2.20060604081244.03dcd938@zend.com> <334553601.20060604171820@marcus-boerger.de> <7.0.1.0.2.20060604083527.034ae330@zend.com> <866332952.20060604175205@marcus-boerger.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] Missing __toString() part From: stas@zend.com (Stanislav Malyshev) MB>>typedef struct _zend_object_value { MB>> zend_object_handle handle; MB>> zend_object_handlers *handlers; MB>>} zend_object_value; MB>> MB>>And wouldn't it be faster to drop both handlers from the table and MB>>instead have zend_object_value have a pointer to zend_class_entry MB>>and that a pounter to the handler table? Not quite - since not all objects have zend_class_entry for them so you couldn't actually use it - unless you insert check each time _and_ write code to handle _both_ cases - using zend_class_entry pointer and using something else - so it's actually easier to do the right thing from the start and use the handlers. Of course, you could "optimize" it for the case zend_class_entry exists and add the zend_class_entry field into the object value - but IMHO the resulting code and model complication would do much more harm than speed improvement on saving one function call (which I'm not sure is of any significance). Also, this would inevitably lead to creating code which forgets to use handlers and breaks in all kinds of funny ways on overloaded objects. My opinion is that it is better to have one consistent API. As for the question why there are two handlers - because class name is useful in all kinds of contexts like backtaces, exceptions, messages, etc. even though you may not have zend_class_entry - so it's a possibility for the overloaded object to give maximum iformation there. -- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/ +972-3-6139665 ext.115