Re: [PHP-DEV] rfc:foreach-non-scalar-keys

2013-01-31 Thread Levi Morrison
> I'm not sure how I came to that conclusion - did the description change > since I looked at it? Maybe a little bit but not very much, if at all. > I guess the title "foreach-non-scalar-keys" may have thrown me off - so > this isn't about arrays, or really even about foreach, but about the > Ite

Re: [PHP-DEV] rfc:foreach-non-scalar-keys

2013-01-31 Thread Nikita Popov
On Fri, Feb 1, 2013 at 1:05 AM, Rasmus Schultz wrote: > I'm not sure how I came to that conclusion - did the description change > since I looked at it? > > I guess the title "foreach-non-scalar-keys" may have thrown me off - so > this isn't about arrays, or really even about foreach, but about th

Re: [PHP-DEV] rfc:foreach-non-scalar-keys

2013-01-31 Thread Rasmus Schultz
I'm not sure how I came to that conclusion - did the description change since I looked at it? I guess the title "foreach-non-scalar-keys" may have thrown me off - so this isn't about arrays, or really even about foreach, but about the Iterator interface. I'm not against that at all. I would sugge

Re: [PHP-DEV] rfc:foreach-non-scalar-keys

2013-01-29 Thread Etienne Kneuss
This RFC is not about arrays. The proposed change is to allow Iterator::key() to return things other than int/strings. Consequently, it would mean foreach($iterable as $key=>$foo) { $key can be an object here }. SplObjectStorage "solves" it by returning an array() of object-key/object-data as *va

Re: [PHP-DEV] rfc:foreach-non-scalar-keys

2013-01-29 Thread Anthony Ferrara
Rasmus, Relax. It hasn't even been proposed yet. Give the author some time to finish the RFC before proposing it here, and then we can discuss it... Anthony On Tue, Jan 29, 2013 at 8:03 AM, Rasmus Schultz wrote: > I just saw this RFC: > > https://wiki.php.net/rfc/foreach-non-scalar-keys > > B

[PHP-DEV] rfc:foreach-non-scalar-keys

2013-01-29 Thread Rasmus Schultz
I just saw this RFC: https://wiki.php.net/rfc/foreach-non-scalar-keys By "non-scalar", presumably we're talking about objects? In the numbers that e.g. resources typically get used, having a collection indexed by resources would seem like an extremely exotic need. Moreover, we already have this: