Re: Internal iteration API

From: Date: Thu, 12 Jul 2012 15:04:37 +0000
Subject: Re: Internal iteration API
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-61167@lists.php.net to get a copy of this message
On 2012-07-12, Sara Golemon <pollita@php.net> wrote: > --e89a8f235453d7a80104c4975c55 > On Wed, Jul 11, 2012 at 5:39 PM, Anthony Ferrara <ircmaxell@gmail.com>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. -- Matthew Weier O'Phinney Project Lead | matthew@zend.com Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

« previous php.internals (#61167) next »