Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61191 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2124 invoked from network); 13 Jul 2012 00:31:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Jul 2012 00:31:50 -0000 Authentication-Results: pb1.pair.com smtp.mail=davidkmuir@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=davidkmuir@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.42 as permitted sender) X-PHP-List-Original-Sender: davidkmuir@gmail.com X-Host-Fingerprint: 209.85.160.42 mail-pb0-f42.google.com Received: from [209.85.160.42] ([209.85.160.42:61649] helo=mail-pb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 87/00-01761-67C6FFF4 for ; Thu, 12 Jul 2012 20:31:50 -0400 Received: by pbbrp12 with SMTP id rp12so5138864pbb.29 for ; Thu, 12 Jul 2012 17:31:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=2xzo1OxNbHr4aEr8LsAJhkqCJZChiNHOGj9MMoOc7VQ=; b=eF0avye3+sbDLsL+e2NgM//1Tfat+SBLyIaw3/IrKwWtjQViVa4QdCKBaHlk4OUiVw IJJ0J1l9LKrQN7NXWj0TkaYjx9+rknGNHst+fB7n3qc+dnutYAcH81N0yMvXuR2g9K84 CIm8bCkZ9stnSRaYn7TV43blOpcpuy072ksKkJv6EjN6h5iXPeXRmIhB1XuSOZLes4ht 5mM9GOJtHB7YlKO0EVPyanxF+rNVL8qDWj8aQd7mG4wQbFGXh4EhzS8VwplGdo4s2uJe pb/HdD6eCVev89PiA1r+9rofso2IS/0+gMe0qCq+T63HiHQTzHMbGbv7cOYx/n5qOT5u ZUGA== Received: by 10.68.224.70 with SMTP id ra6mr9847452pbc.11.1342139507274; Thu, 12 Jul 2012 17:31:47 -0700 (PDT) Received: from [192.168.0.5] (dsl-202-173-152-56.vic.westnet.com.au. [202.173.152.56]) by mx.google.com with ESMTPS id nh8sm4808819pbc.60.2012.07.12.17.31.45 (version=SSLv3 cipher=OTHER); Thu, 12 Jul 2012 17:31:46 -0700 (PDT) Message-ID: <4FFF6C9C.2080802@gmail.com> Date: Fri, 13 Jul 2012 10:32:28 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: Matthew Weier O'Phinney CC: internals@lists.php.net References: <1342050547.1456.33.camel@guybrush> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Internal iteration API From: davidkmuir@gmail.com (David Muir) On 13/07/12 01:04, Matthew Weier O'Phinney wrote: > On 2012-07-12, Sara Golemon wrote: >> --e89a8f235453d7a80104c4975c55 >> On Wed, Jul 11, 2012 at 5:39 PM, Anthony Ferrara wrote: >>> One thing to keep in mind when doing this is to think about consistency. >>> I think that's a huge point not to be taken lightly. For that reason, I >>> think that this API should not be used for any of the array_* functions. >>> Meaning that array_sum(), etc should all take arrays only. >>> >>> Then, other non-array functions (such as str_replace, etc) can be modified >>> to use this new method. >>> >>> Just my $0.02 anyway... >>> >> Sounds like everyone agrees the API is useful, just question marks over >> which existing methods should profit by it. >> >> To add my $0.02, it'd be nice to work in a zend_parse_parameters() type for >> this. Keep extension code clean and ensures any temporary iterators get >> destructed. > Another note: if this comes to fruition, since arrays and traversable objects > would in many cases be interchangeable, it would be nice to have a type-hint for > "array-like" behavior: > > function doSomething (ArrayLike $options) { ... } > > A better name could likely be used, but you get the idea. > What about extending the array typehint include ArrayAccess, and extend the Traversable typehint to include arrays?