Re: [PHP-DEV] Internal iteration API

2012-07-25 Thread jpauli
On Wed, Jul 25, 2012 at 6:52 AM, Larry Garfield wrote: > On 07/24/2012 03:52 AM, jpauli wrote: >> >> On Sat, Jul 14, 2012 at 2:35 AM, Stas Malyshev >> wrote: >>> >>> Hi! >>> So, I've not been inside the engine so in practice this may make no sense at all, but what about looking at it th

Re: [PHP-DEV] Internal iteration API

2012-07-24 Thread Larry Garfield
On 07/24/2012 03:52 AM, jpauli wrote: On Sat, Jul 14, 2012 at 2:35 AM, Stas Malyshev wrote: Hi! So, I've not been inside the engine so in practice this may make no sense at all, but what about looking at it the other way around? Vis, instead of making objects more and more like arrays, make

Re: [PHP-DEV] Internal iteration API

2012-07-24 Thread jpauli
On Sat, Jul 14, 2012 at 2:35 AM, Stas Malyshev wrote: > Hi! > >> So, I've not been inside the engine so in practice this may make no >> sense at all, but what about looking at it the other way around? Vis, >> instead of making objects more and more like arrays, make arrays an >> object that happe

Re: [PHP-DEV] Internal iteration API

2012-07-21 Thread Johannes Schlüter
On Fri, 2012-07-13 at 10:32 +1000, David Muir wrote: > What about extending the array typehint include ArrayAccess, and extend > the Traversable typehint to include arrays? For that all (internal) consumers of Traversable have to work with arrays. i.e. . This could be in the scope of the internal

Re: [PHP-DEV] Internal iteration API

2012-07-15 Thread Andrew Faulds
forwarding. On 16 July 2012 02:11, Larry Garfield wrote: > I think you meant to send that to the list. :-) > > --Larry Garfield > > > On 07/15/2012 08:07 PM, Andrew Faulds wrote: >> >> It would be nice if PHP 6 unified the semantics of >> string/int/float/bool, arrays, and objects. For those firs

Re: [PHP-DEV] Internal iteration API

2012-07-15 Thread Larry Garfield
On 07/13/2012 07:35 PM, Stas Malyshev wrote: Hi! So, I've not been inside the engine so in practice this may make no sense at all, but what about looking at it the other way around? Vis, instead of making objects more and more like arrays, make arrays an object that happens to implement ArrayA

Re: [PHP-DEV] Internal iteration API

2012-07-13 Thread Stas Malyshev
Hi! > So, I've not been inside the engine so in practice this may make no > sense at all, but what about looking at it the other way around? Vis, > instead of making objects more and more like arrays, make arrays an > object that happens to implement ArrayAccess, Iterator, and whatever That'

Re: [PHP-DEV] Internal iteration API

2012-07-13 Thread Larry Garfield
On 7/13/12 12:30 PM, Stas Malyshev wrote: 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

Re: [PHP-DEV] Internal iteration API

2012-07-13 Thread 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 some

Re: [PHP-DEV] Internal iteration API

2012-07-13 Thread jpauli
On Fri, Jul 13, 2012 at 3:55 PM, Matthew Weier O'Phinney wrote: > On 2012-07-13, David Muir wrote: >> 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 >> > > w

Re: [PHP-DEV] Internal iteration API

2012-07-13 Thread Matthew Weier O'Phinney
On 2012-07-13, David Muir wrote: > 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 abou

RE: [PHP-DEV] Internal iteration API

2012-07-13 Thread Jared Williams
> -Original Message- > From: Nikita Popov [mailto:nikita@gmail.com] > Sent: 11 July 2012 23:17 > To: PHP internals > Subject: [PHP-DEV] Internal iteration API > > Hi internals! > > Currently PHP does not have an internal iteration API that > supports both arrays and Traversable o

Re: [PHP-DEV] Internal iteration API

2012-07-12 Thread 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

Re: [PHP-DEV] Internal iteration API

2012-07-12 Thread Matthew Weier O'Phinney
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

Re: [PHP-DEV] Internal iteration API

2012-07-12 Thread Nikita Popov
On Thu, Jul 12, 2012 at 1:49 AM, Johannes Schlüter wrote: > One thing to keep in mind when doing this is to think about consistency. > Right there's quite a distinction. Things either take an array or a > Traversable object. We should think about not creating a mess when some > functions, especial

Re: [PHP-DEV] Internal iteration API

2012-07-11 Thread Stas Malyshev
Hi! > One thing to keep in mind when doing this is to think about consistency. > Right there's quite a distinction. Things either take an array or a > Traversable object. We should think about not creating a mess when some > functions, especially ones called array_foo() allow Traversable while > o

Re: [PHP-DEV] Internal iteration API

2012-07-11 Thread Stas Malyshev
Hi! > 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. Definitely, that'd be a great benefit. Just return zend_iterator * which you can use to get current/next zvals and converting

Re: [PHP-DEV] Internal iteration API

2012-07-11 Thread Johannes Schlüter
On Wed, 2012-07-11 at 20:39 -0400, Anthony Ferrara wrote: > Johannes, > > 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_* functi

Re: [PHP-DEV] Internal iteration API

2012-07-11 Thread Sara Golemon
On Wed, Jul 11, 2012 at 5:39 PM, Anthony Ferrara wrote: > Johannes, > > 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

Re: [PHP-DEV] Internal iteration API

2012-07-11 Thread Anthony Ferrara
Johannes, 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, o

Re: [PHP-DEV] Internal iteration API

2012-07-11 Thread Johannes Schlüter
On Thu, 2012-07-12 at 01:49 +0200, Johannes Schlüter wrote: > Just picking some random example: > > * array_map() - This can be implemented using that infrastructure. > (While some might think about returning an Traversable object if > a Traversable object got put in, maybe a

Re: [PHP-DEV] Internal iteration API

2012-07-11 Thread Johannes Schlüter
On Thu, 2012-07-12 at 00:17 +0200, Nikita Popov wrote: > Hi internals! > > Currently PHP does not have an internal iteration API that supports > both arrays and Traversable objects. Yes. in fact doing that is long overdue. > Because of that it is currently > not really possible to write functio

Re: [PHP-DEV] Internal iteration API

2012-07-11 Thread Sara Golemon
Love the idea. +1 On Wed, Jul 11, 2012 at 3:17 PM, Nikita Popov wrote: > Hi internals! > > Currently PHP does not have an internal iteration API that supports > both arrays and Traversable objects. Because of that it is currently > not really possible to write functions (or language features) th