Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61210 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88422 invoked from network); 13 Jul 2012 17:30:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Jul 2012 17:30:36 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.133 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.133 smtp133.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.133] ([67.192.241.133:46998] helo=smtp133.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6C/50-20866-B3B50005 for ; Fri, 13 Jul 2012 13:30:35 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp13.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 344E13D018B; Fri, 13 Jul 2012 13:30:33 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp13.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id C75C73D01EB; Fri, 13 Jul 2012 13:30:32 -0400 (EDT) Message-ID: <50005B38.3090507@sugarcrm.com> Date: Fri, 13 Jul 2012 10:30:32 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: jpauli CC: Matthew Weier O'Phinney , "internals@lists.php.net" References: <1342050547.1456.33.camel@guybrush> <4FFF6C9C.2080802@gmail.com> <36.A6.17670.8E820005@pb1.pair.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Internal iteration API From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > Yep, today we have : > - arrays > - Object implementing ArrayAccess > - Objects implementing Traversable (Iterator) > - array_****() functions not working with ArrayAccess' objects > - Iterator API not working with arrays (ArrayIterator needed) > - ... I forget things > > There sure is something to do with that to make a consistent API. Definitely, having consistent generic iteration API would be great, and pretty much the only reason many iterative functions don't suport traversables is that there's no such API. As for ArrayAccess, it's more complicated. For example, if you have array_shift() I'm not sure ArrayAccess is enough to implement it. To find out "first" element you'd need Traversable, but even that won't allow you to "shift" array elements. So for some array_* functions only thing that you can rely on is an actual array... -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227