Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21897 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75802 invoked by uid 1010); 17 Feb 2006 08:18:57 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 75787 invoked from network); 17 Feb 2006 08:18:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Feb 2006 08:18:56 -0000 X-Host-Fingerprint: 81.169.182.136 ajaxatwork.net Linux 2.4/2.6 Received: from ([81.169.182.136:36549] helo=strato.aixcept.de) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 64/C0-02358-FE685F34 for ; Fri, 17 Feb 2006 03:18:55 -0500 Received: from [192.168.1.3] (dslb-084-063-052-109.pools.arcor-ip.net [84.63.52.109]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by strato.aixcept.de (Postfix) with ESMTP id 8CF6835C1DD; Fri, 17 Feb 2006 09:18:51 +0100 (CET) Date: Fri, 17 Feb 2006 09:18:51 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1683874889.20060217091851@marcus-boerger.de> To: l0t3k Cc: internals@lists.php.net In-Reply-To: <6E.C0.24520.1C415F34@pb1.pair.com> References: <49.81.03593.F1463F34@pb1.pair.com> <1355657626.20060215225041@marcus-boerger.de> <6E.C0.24520.1C415F34@pb1.pair.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] C Level Iterators and Userland Classes From: helly@php.net (Marcus Boerger) Hello l0t3k, in SPL the iterator classes can be overloaded in TextIterator not. Foreach does what is necccessary and especially if inside foreach() someone uses the value it is being copied automatically. Since you do it all yourself you also need to do the copying yourself. So there is no inconsistency, just diiferent usage. regards marcus Friday, February 17, 2006, 1:09:37 AM, you wrote: > Marcus, > one last question ... >> You should never touch the data member of that iterator > does this mean that i should make a copy of whatever i get from > the get_current_data() handler ? There seems to be a bit of inconsistency > in dealing with the current element in the iterators For example, the > TextIterator > reuses the same zval value, whereas the classes in SPL call zval_ptr_dtor() > between iterations. > clayton Best regards, Marcus