Re: [PHP-DEV] Re: [RFC] foreach_variable supporting T_LIST

2012-07-21 Thread Morgan L. Owens
On 2012-07-21 12:19, Stas Malyshev wrote: Hi! So when I have a function that has a two- or multi-part result then - instead of having one part as the return value and the others by reference - in Python I'd return a tuple. PHP functions can return arrays and some do - e.g. pathinfo(). But not

Re: [PHP-DEV] Re: [RFC] foreach_variable supporting T_LIST

2012-07-20 Thread Stas Malyshev
Hi! > The number of values in a DB result set may be unpredictable, but the > number of _elements_ in each value shouldn't be - and the list() will be > on those elements: > > foreach($resultset as list($id, $name, $address, $phone)) > { One doesn't see this pattern too much and the reason is

Re: Re: [PHP-DEV] Re: [RFC] foreach_variable supporting T_LIST

2012-07-20 Thread Morgan L. Owens
On 2012-07-21 10:28, Stas Malyshev wrote: Hi! If I understand this correctly, this is like what Python let's you do with tuples. It's handy for getting vector components, hostnames and port numbers, etc. (I apologise for the Python comparison, it is just the language where I usually encounter t

Re: [PHP-DEV] Re: [RFC] foreach_variable supporting T_LIST

2012-07-20 Thread Andrew Faulds
Yeah, that's what I realised as I wrote that. PHP functions don't really use tuples etc. very much, unlike Python. That said, now we have short array syntax, and if we add this, perhaps people will use it more. Still, at the moment the usefulness of this is limited. Perhaps destructuring assignmen

Re: [PHP-DEV] Re: [RFC] foreach_variable supporting T_LIST

2012-07-20 Thread Stas Malyshev
Hi! > If I understand this correctly, this is like what Python let's you do > with tuples. It's handy for getting vector components, hostnames and > port numbers, etc. (I apologise for the Python comparison, it is just > the language where I usually encounter this, and it makes heavy use of > fore

Re: [PHP-DEV] Re: [RFC] foreach_variable supporting T_LIST

2012-07-20 Thread Andrew Faulds
If I understand this correctly, this is like what Python let's you do with tuples. It's handy for getting vector components, hostnames and port numbers, etc. (I apologise for the Python comparison, it is just the language where I usually encounter this, and it makes heavy use of foreach-style loops

Re: [PHP-DEV] Re: [RFC] foreach_variable supporting T_LIST

2012-07-20 Thread Stas Malyshev
Hi! >since I proposed last year, and seems no argu here. > >so maybe we can just step into the voting phase? I'd like to know how it works with references. I.e., you can do: foreach($foo as &$bar) What about the list, how would you use that? Also, I'm not sure which use case we're so

[PHP-DEV] Re: [RFC] foreach_variable supporting T_LIST

2012-07-20 Thread Laruence
Hi: since I proposed last year, and seems no argu here. so maybe we can just step into the voting phase? thanks On Wed, Jul 18, 2012 at 10:55 PM, Laruence wrote: > On Wed, Jul 18, 2012 at 10:49 PM, Laruence wrote: >> Hi: >> this is not a new RFC, I proposed it before, but due to

[PHP-DEV] Re: [RFC] foreach_variable supporting T_LIST

2012-07-18 Thread Laruence
On Wed, Jul 18, 2012 at 10:49 PM, Laruence wrote: > Hi: > this is not a new RFC, I proposed it before, but due to my poor > english and improper examples, it didn't get passed. thanks phidev's good english, he re-wrote the descriptions. thanks > > This feature introduces list() suppor