Re: [PHP-DEV] in Operator

2015-01-23 Thread Rowan Collins
Yasuo Ohgaki wrote on 23/01/2015 03:01: Hi Niklas, On Mon, Jan 19, 2015 at 9:42 AM, Niklas Keller wrote: >I'd like to propose a new feature to PHP: The in Operator >Bob mentioned a few weeks ago he wants such an operator in PHP and today I >stumbled over > >http://nikic.github.io/2012/07/27/H

Re: [PHP-DEV] in Operator

2015-01-22 Thread Yasuo Ohgaki
Hi Niklas, On Mon, Jan 19, 2015 at 9:42 AM, Niklas Keller wrote: > I'd like to propose a new feature to PHP: The in Operator > Bob mentioned a few weeks ago he wants such an operator in PHP and today I > stumbled over > > http://nikic.github.io/2012/07/27/How-to-add-new-syntactic-features-to-PHP

Re: [PHP-DEV] in Operator

2015-01-22 Thread Larry Garfield
On 01/20/2015 09:42 AM, Rowan Collins wrote: Mike Willbanks wrote on 20/01/2015 03:30: I am very familiar with the in operator. However, the implementation would be incomplete without handling loops via the in operator. Many people when seeing an in operator also think of JavaScript. In that

RE: [PHP-DEV] in Operator

2015-01-20 Thread François Laupretre
> De : Rowan Collins [mailto:rowan.coll...@gmail.com] > > Given the ability to write foreach ( $foo as $key => $value ), I'm not > sure adding a variant syntax of for ( $key in $foo ) has that much value > for PHP. +1. Useless and ambiguous. -- PHP Internals - PHP Runtime Development Mailing L

Re: [PHP-DEV] in Operator

2015-01-20 Thread Stanislav Malyshev
Hi! > Agree, but maybe a RFC for "in" operator and a follow up RFC to allow > "in" on "for" context could be a win/win here as long as one feature > doesn't block each other? The problem is "in" is not just "for". The problem is this: when you say "$foo in $bar", is $foo a value or a key? In many

Re: [PHP-DEV] in Operator

2015-01-20 Thread Dennis Birkholz
Am 20.01.2015 um 16:42 schrieb Rowan Collins: > Given the ability to write foreach ( $foo as $key => $value ), I'm not > sure adding a variant syntax of for ( $key in $foo ) has that much value > for PHP. I totally agree with you here. The only real reason why Javascript has a for-in operation t

Re: [PHP-DEV] in Operator

2015-01-20 Thread Rowan Collins
Mike Willbanks wrote on 20/01/2015 03:30: I am very familiar with the in operator. However, the implementation would be incomplete without handling loops via the in operator. Many people when seeing an in operator also think of JavaScript. In that case the in operator iterates over properties

Re: [PHP-DEV] in Operator

2015-01-20 Thread Marcio Almada
Mike, Back to the subject,: > It is indeed different but ever so slightly, a for loop in this case cannot > handle a single argument of true and would cause a parse error. > Therefore for ("PHP" in ["PHP, "C", "Java"]) could be handled differently. > Again, my main point is that due to other

Re: [PHP-DEV] in Operator

2015-01-20 Thread Marcio Almada
Mike, > Also FYI - in the future please try not to top post and instead post under > where you are commenting as it makes it more difficult for > people coming later to the thread to see the scope of the conversation. Thanks for the tip! I read to "do not top post" on the guidelines but had no c

Re: [PHP-DEV] in Operator

2015-01-20 Thread Mike Willbanks
Hello, On Tue, Jan 20, 2015 at 7:47 AM, Marcio Almada wrote: > Hi, > > Mike, the use of "in" as `for ($var in $object) {};` could be the > subject for another distinct RFC since it's doing something different > from the original proposal: > > var_dump("PHP" in ["PHP", "C", "Java"]); // true > I

Re: [PHP-DEV] in Operator

2015-01-20 Thread Marcio Almada
Hi, Mike, the use of "in" as `for ($var in $object) {};` could be the subject for another distinct RFC since it's doing something different from the original proposal: var_dump("PHP" in ["PHP", "C", "Java"]); // true 2015-01-20 10:41 GMT-03:00 Mike Willbanks : > Hello Pierre, Andrea and Niklas,

Re: [PHP-DEV] in Operator

2015-01-20 Thread Mike Willbanks
Hello Pierre, Andrea and Niklas, On Mon, Jan 19, 2015 at 11:35 PM, Pierre Joye wrote: > On Tue, Jan 20, 2015 at 6:15 AM, Andrea Faulds wrote: > >> On 20 Jan 2015, at 03:30, Mike Willbanks wrote: > >> > >> I am very familiar with the in operator. However, the implementation > >> would be inco

Re: [PHP-DEV] in Operator

2015-01-20 Thread Niklas Keller
2015-01-20 6:35 GMT+01:00 Pierre Joye : > On Tue, Jan 20, 2015 at 6:15 AM, Andrea Faulds wrote: >> Hi Mike, >> >>> On 20 Jan 2015, at 03:30, Mike Willbanks wrote: >>> >>> I am very familiar with the in operator. However, the implementation >>> would be incomplete without handling loops via the

Re: [PHP-DEV] in Operator

2015-01-19 Thread Pierre Joye
On Tue, Jan 20, 2015 at 6:15 AM, Andrea Faulds wrote: > Hi Mike, > >> On 20 Jan 2015, at 03:30, Mike Willbanks wrote: >> >> I am very familiar with the in operator. However, the implementation >> would be incomplete without handling loops via the in operator. Many >> people when seeing an in o

Re: [PHP-DEV] in Operator

2015-01-19 Thread Andrea Faulds
Hi Mike, > On 20 Jan 2015, at 03:30, Mike Willbanks wrote: > > I am very familiar with the in operator. However, the implementation > would be incomplete without handling loops via the in operator. Many > people when seeing an in operator also think of JavaScript. In that case > the in opera

Re: [PHP-DEV] in Operator

2015-01-19 Thread Mike Willbanks
Hello Niklas, On Sun, Jan 18, 2015 at 6:42 PM, Niklas Keller wrote: > Hello, > > I'd like to propose a new feature to PHP: The in Operator > Bob mentioned a few weeks ago he wants such an operator in PHP and today I > stumbled over > > http://nikic.github.io/2012/07/27/How-to-add-new-syntactic-f

[PHP-DEV] in Operator

2015-01-19 Thread Niklas Keller
Hello, I'd like to propose a new feature to PHP: The in Operator Bob mentioned a few weeks ago he wants such an operator in PHP and today I stumbled over http://nikic.github.io/2012/07/27/How-to-add-new-syntactic-features-to-PHP.html again, which uses the in operator as a sample. Use cases: $obj