# [VOTE]Call for voting: support use list in foreach

- Thread: https://externals.io/message/62232
- Original archive: https://news-web.php.net/php.internals/62232
- Started by Laruence on 2012-08-18T04:34:32+00:00
- Messages: 27
- RFC: foreach_variable supporting T_LIST (Implemented (PHP 5.5)) — https://externals.io/rfc/foreachlist.md
- Page 1 of 2: messages 1 to 25 (25 per page, add `?page=N` to the URL)
- Next page: https://externals.io/message/62232.md?page=2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #62232 — Laruence — 2012-08-18T04:34:32+00:00

URL: https://externals.io/message/62232#62232

Hi:
    This feature introduces list() support in foreach constructs(more
info can be found here: https://wiki.php.net/rfc/foreachlist).

    this could make the grammar more consistent,  see following example:

 <?php
$users = array(
    array('Foo', 'Bar'),
    array('Baz', 'Qux');
);

// Before
foreach ($users as $user) {
    list($firstName, $lastName) = $user;
    echo "First name: $firstName, last name: $lastName. ";
}

// After
foreach ($users as list($firstName, $lastName)) {
    echo "First name: $firstName, last name: $lastName. ";
}
?>

  previous discussion could be found at :
http://marc.info/?l=php-internals&m=134277050215818&w=2

  please vote for this: https://wiki.php.net/rfc/foreachlist#vote

thanks :)

-- 
Laruence  Xinchen Hui
http://www.laruence.com/

---

## #62235 — Nikita Popov — 2012-08-18T09:48:23+00:00

URL: https://externals.io/message/62232#62235 · In reply to: #62232

> Hi:
>     This feature introduces list() support in foreach constructs(more
> info can be found here: https://wiki.php.net/rfc/foreachlist).
>
>   please vote for this: https://wiki.php.net/rfc/foreachlist#vote

Hi Lauruence!

Is this vote just for list() or also for error suppression? I'd vote
+1 on the first, but -1 on the second, so it would be nice to make it
more clear ;)

Nikita

---

## #62254 — Laruence — 2012-08-19T06:07:13+00:00

URL: https://externals.io/message/62232#62254 · In reply to: #62235

> 
> > […]
>
> Hi Lauruence!
>
> Is this vote just for list() or also for error suppression? I'd vote
> +1 on the first, but -1 on the second, so it would be nice to make it
> more clear ;)
Hi,

   okey,  I opened another vote for the foreach list with silent token
supporting.

thanks

>
> Nikita



-- 
Laruence  Xinchen Hui
http://www.laruence.com/

---

## #62277 — Sherif Ramadan — 2012-08-20T06:36:08+00:00

URL: https://externals.io/message/62232#62277 · In reply to: #62254

> 
> > […]
> Hi,
>
>    okey,  I opened another vote for the foreach list with silent token
> supporting.
>
> thanks
>
> > […]
>
>
>


Sorry, I feel like I missed the discussion phase of this RFC. I'm
unclear about how this behavior in the construct will affect existing
code. Currently, you can only use list() with arrays that have
sequential numeric keys starting from 0. So the follow does not
currently work with the list construct...

list($x, $y) = array('x'=>1, 'y'=>2); // This won't work

/* This won't work either.. at least not the way I'd expect because $y
will end up being 1 and $x will be null and an `E_NOTICE` level error is
thrown. */
list($x, $y) = array(1=>1, 2=>2);
var_dump($x, $y);
/*
 `NULL` 
int(1)
*/

While I see the use of the list construct as a minor improvement in
readability (it does add some syntactic sugar), I also can't imagine
that it makes things any more consistent, which is one of the points
of this RFC.

This also means that if we chose to avoid this extra level of
indirection by way of list in foreach constructs we can't expect to
access the key, which might make for another ambiguity and lead us
back to just using something like the following...

$array = array(
    'Cape Cod' => array('lat' => 12.20, 'long' => 34.60),
    'North Shore' => array('lat' => 18.72, 'long' => 4.11),
    'Mount Erie' => array('lat' => 6.02, 'long' => 21.79),
);
foreach ($array as $point => $coordinates) {
  $lat = $coordinates['lat'];
  $long = $coordinates['long'];
  echo "Coordinates for $point are: LAT = $lat, LONG = $long\n";
}

I understand we can simply say this would not be an ideal use case for
this, but then it becomes a tiny variation in syntax that only solves
a specific problem.

---

## #62480 — Laruence — 2012-08-25T12:33:50+00:00

URL: https://externals.io/message/62232#62480 · In reply to: #62232

Hi:
   Voting closed.

   Result:
   foreach supports list syntax:  11 for yes,  4 for no.   accepted.
   foreach supports list with silent token:  2 for yes, 10 for no.  denied.

   thanks for your great advise.

   I will commit the patch later.

thanks


> Hi:
>     This feature introduces list() support in foreach constructs(more
> info can be found here: https://wiki.php.net/rfc/foreachlist).
>
>     this could make the grammar more consistent,  see following example:
>
>  <?php
> $users = array(
>     array('Foo', 'Bar'),
>     array('Baz', 'Qux');
> );
>
> // Before
> foreach ($users as $user) {
>     list($firstName, $lastName) = $user;
>     echo "First name: $firstName, last name: $lastName. ";
> }
>
> // After
> foreach ($users as list($firstName, $lastName)) {
>     echo "First name: $firstName, last name: $lastName. ";
> }
> ?>
>
>   previous discussion could be found at :
> http://marc.info/?l=php-internals&m=134277050215818&w=2
>
>   please vote for this: https://wiki.php.net/rfc/foreachlist#vote
>
> thanks :)
>
> --
> Laruence  Xinchen Hui
> http://www.laruence.com/



-- 
Laruence  Xinchen Hui
http://www.laruence.com/

---

## #62481 — Andrew Faulds — 2012-08-25T12:36:46+00:00

URL: https://externals.io/message/62232#62481 · In reply to: #62480

> Hi:
>     Voting closed.
>
>     Result:
>     foreach supports list syntax:  11 for yes,  4 for no.   accepted.
>     foreach supports list with silent token:  2 for yes, 10 for no.  denied.
>
>     thanks for your great advise.
>
>     I will commit the patch later.
>
> thanks
>
> 
> > […]
>
>
Great, now I can do in PHP what I've been able to do in Python for 
years, but with uglier syntax! :P

-- 
Andrew Faulds
http://ajf.me/

---

## #62510 — Stas Malyshev — 2012-08-26T17:42:27+00:00

URL: https://externals.io/message/62232#62510 · In reply to: #62480

Hi!

>    foreach supports list syntax:  11 for yes,  4 for no.   accepted.
>    foreach supports list with silent token:  2 for yes, 10 for no.  denied.

And here's again the problem with this voting setup. With all these long
discussions about people not getting votes we have 15 people that
bothered to vote at all, and essentially the vote is decided by one or
two single votes, and the vote doesn't even have to be from a PHP
contributor - but the vote of anybody who can register on PHP wiki is
enough to decide questions on the core of the language. And I'm not
talking about "the voice of the masses" there but by a single vote of
anybody who bothers to vote, which 99% of people just do not.

I do not this it is a healthy state of things. Sorry to raise the topic
that was discussed 1000 times before, but the situation does not seem to
improve.
-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

---

## #62511 — Yahav Gindi Bar — 2012-08-26T17:46:21+00:00

URL: https://externals.io/message/62232#62511 · In reply to: #62510

On Sun, Aug 26, 2012 at 8:42 PM, Stas Malyshev <smalyshev@sugarcrm.com>wrote:

> Hi!
>
> > […]
>  denied.
>
> And here's again the problem with this voting setup. With all these long
> discussions about people not getting votes we have 15 people that
> bothered to vote at all, and essentially the vote is decided by one or
> two single votes, and the vote doesn't even have to be from a PHP
> contributor - but the vote of anybody who can register on PHP wiki is
> enough to decide questions on the core of the language. And I'm not
> talking about "the voice of the masses" there but by a single vote of
> anybody who bothers to vote, which 99% of people just do not.
>
> I do not this it is a healthy state of things. Sorry to raise the topic
> that was discussed 1000 times before, but the situation does not seem to
> improve.
> --
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
> (408)454-6900 ext. 227
>
> --
> 
> 
>
>
I got a PHP Wiki account but couldn't vote. Are you sure the Wiki accounts
got the permissions to vote?

---

## #62512 — Stas Malyshev — 2012-08-26T17:48:35+00:00

URL: https://externals.io/message/62232#62512 · In reply to: #62511

Hi!


> I got a PHP Wiki account but couldn't vote. Are you sure the Wiki
> accounts got the permissions to vote?

Hm... Not sure, maybe somebody has to enable it?
-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

---

## #62514 — Nikita Popov — 2012-08-26T17:53:06+00:00

URL: https://externals.io/message/62232#62514 · In reply to: #62510

> Hi!
>
> > […]
>
> And here's again the problem with this voting setup. With all these long
> discussions about people not getting votes we have 15 people that
> bothered to vote at all, and essentially the vote is decided by one or
> two single votes, and the vote doesn't even have to be from a PHP
> contributor - but the vote of anybody who can register on PHP wiki is
> enough to decide questions on the core of the language. And I'm not
> talking about "the voice of the masses" there but by a single vote of
> anybody who bothers to vote, which 99% of people just do not.

Only people with a VCS account (or voting group) can vote.

Nikita

---

## #62515 — Stas Malyshev — 2012-08-26T17:58:51+00:00

URL: https://externals.io/message/62232#62515 · In reply to: #62514

Hi!

> Only people with a VCS account (or voting group) can vote.

OK, I stand corrected then, but participation rate is still awfully low.
We can't talk about consensus when everything is decided on one vote.

-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

---

## #62516 — Will Fitch — 2012-08-26T18:00:57+00:00

URL: https://externals.io/message/62232#62516 · In reply to: #62515

Maybe the simplest solution is we have a minimum participation rate before
voting can be closed?

On Sun, Aug 26, 2012 at 1:58 PM, Stas Malyshev <smalyshev@sugarcrm.com>wrote:

> Hi!
>
> > […]
>
> OK, I stand corrected then, but participation rate is still awfully low.
> We can't talk about consensus when everything is decided on one vote.
>
> --
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
> (408)454-6900 ext. 227

---

## #62517 — Yahav Gindi Bar — 2012-08-26T18:07:56+00:00

URL: https://externals.io/message/62232#62517 · In reply to: #62516

> Maybe the simplest solution is we have a minimum participation rate before
> voting can be closed?
>
> Though it make sense - it's a problem, because it'll delay and reject some
useful features because of requirements issue.


> On Sun, Aug 26, 2012 at 1:58 PM, Stas Malyshev <smalyshev@sugarcrm.com
> > […]
>
> > […]
>

+1
 But giving vote for anybody is kind of bad idea too... so its a problem

---

## #62521 — Peter Cowburn — 2012-08-26T18:17:59+00:00

URL: https://externals.io/message/62232#62521 · In reply to: #62512

>
> > […]
>
> Hm... Not sure, maybe somebody has to enable it?

There is a special group ("voting" IIRC) for wiki accounts with voting
rights.  "Ordinary" (non-php.net) wiki account holders cannot vote.
Someone with DB access would need to check, but I believe there are
(were) only a couple of people in this special voting group.

---

## #62528 — Lester Caine — 2012-08-26T19:20:51+00:00

URL: https://externals.io/message/62232#62528 · In reply to: #62517

Yahav Gindi Bar wrote:
> > […]
> +1
>   But giving vote for anybody is kind of bad idea too... so its a problem

Currently how many people ARE entitled to vote anyway?
And how many of those have been active in the last year?

( And how many here would like to be able to vote? )

-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

---

## #62529 — Yahav Gindi Bar — 2012-08-26T19:25:55+00:00

URL: https://externals.io/message/62232#62529 · In reply to: #62528

> Yahav Gindi Bar wrote:
>
> > […]
>
> Currently how many people ARE entitled to vote anyway?
> And how many of those have been active in the last year?
>
> ( And how many here would like to be able to vote? )
>
> --
> Lester Caine - G8HFL
> -----------------------------
> Contact - http://lsces.co.uk/wiki/?page=**contact<http://lsces.co.uk/wiki/?page=contact>
> L.S.Caine Electronic Services - http://lsces.co.uk
> EnquirySolve - http://enquirysolve.com/
> Model Engineers Digital Workshop - http://medw.co.uk
> Rainbow Digital Media - http://rainbowdigitalmedia.co.**uk<http://rainbowdigitalmedia.co.uk>
>
>
>
>
> --
> 
> 
>
>
From the recent voting, the average participates is 10...
https://wiki.php.net/rfc/foreachlist
https://wiki.php.net/rfc/apxs-loadmodule/results
https://wiki.php.net/rfc/datetime_and_daylight_saving_time/vote
https://wiki.php.net/rfc/finally
https://wiki.php.net/rfc/constdereference


I'd like! ;).
(Though I've joined the group only month or two ago...)

---

## #62549 — Yasuo Ohgaki — 2012-08-27T01:43:10+00:00

URL: https://externals.io/message/62232#62549 · In reply to: #62515

2012/8/27 Stas Malyshev <smalyshev@sugarcrm.com>:
> Hi!
>
> > […]
>
> OK, I stand corrected then, but participation rate is still awfully low.
> We can't talk about consensus when everything is decided on one vote.

How about send notification emails and if one didn't participate
any vote more than 3 years, then revoke karma.
If 3 years are too short, make it 4 or 5 years.

Obsolete accounts can be cleaned with this method.
Just an idea.

Regards,

--
Yasuo Ohgaki
yohgaki@ohgaki.net

---

## #62558 — Hannes Magnusson — 2012-08-27T09:46:52+00:00

URL: https://externals.io/message/62232#62558 · In reply to: #62521

> 
> > […]
>
> There is a special group ("voting" IIRC) for wiki accounts with voting
> rights.  "Ordinary" (non-php.net) wiki account holders cannot vote.
> Someone with DB access would need to check, but I believe there are
> (were) only a couple of people in this special voting group.
>

There are 1651 persons with php.net VCS account. There is however no
way to tell how active they are.
There are 2 people with specific voting karma, I think Pierre demanded
they got karma.

Noone else can vote. That should be obvious by looking up the names of
the voters on http://people.php.net.

And why is this discussion buried in a foreach() voting announcement thread?

-Hannes

---

## #62565 — Laruence — 2012-08-27T14:37:42+00:00

URL: https://externals.io/message/62232#62565 · In reply to: #62510

Hi:
    sorry to replying top.

    this is really a minor features, so few people are interesting in
this. thus fewer people will vote for it.

    if people interesting in the RFC, he will vote. so I think it's okey..

thanks


> Hi!
>
> > […]
>
> And here's again the problem with this voting setup. With all these long
> discussions about people not getting votes we have 15 people that
> bothered to vote at all, and essentially the vote is decided by one or
> two single votes, and the vote doesn't even have to be from a PHP
> contributor - but the vote of anybody who can register on PHP wiki is
> enough to decide questions on the core of the language. And I'm not
> talking about "the voice of the masses" there but by a single vote of
> anybody who bothers to vote, which 99% of people just do not.
>
> I do not this it is a healthy state of things. Sorry to raise the topic
> that was discussed 1000 times before, but the situation does not seem to
> improve.
> --
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
> (408)454-6900 ext. 227



-- 
Laruence  Xinchen Hui
http://www.laruence.com/

---

## #62569 — Pierre Joye — 2012-08-27T23:06:20+00:00

URL: https://externals.io/message/62232#62569 · In reply to: #62510

>
> Hi!
>
> > […]
>
> And here's again the problem with this voting setup. With all these long
> discussions about people not getting votes we have 15 people that
> bothered to vote at all, and essentially the vote is decided by one or
> two single votes, and the vote doesn't even have to be from a PHP
> contributor - but the vote of anybody who can register on PHP wiki is
> enough to decide questions

No. One has to get the vote/rfc karma. If that has changed, we have
you restore this restriction.



> anybody who bothers to vote, which 99% of people just do not.


If one does not participate, his fault.


Btw, we also have the 2/3 rule for language change as well.

Cheers,
Pierre

---

## #62570 — johannes@schlueters.de — 2012-08-28T00:21:01+00:00

URL: https://externals.io/message/62232#62570 · In reply to: #62517

> 
> 
> > […]
> Though it make sense - it's a problem, because it'll delay and reject some
> useful features because of requirements issue.

If it is useful it should have enough supporters, else it most likely
isn't useful. While there should be an option to actively abstain from
voting.

johannes

---

## #62571 — Pierre Joye — 2012-08-28T08:18:09+00:00

URL: https://externals.io/message/62232#62571 · In reply to: #62570

hi,

On Tue, Aug 28, 2012 at 2:21 AM, Johannes Schlüter
<johannes@schlueters.de> wrote:
> 
> > […]
>
> If it is useful it should have enough supporters, else it most likely
> isn't useful. While there should be an option to actively abstain from
> voting.

I am not sure the usefulness of this option, but it is possible to add
a blank field ot any vote.

If the idea is to say 'I do not care enough to vote yes or no' then
simply vote no as one obviously either did not the RFC or do not want
it.

But this is off topic again in this thread, what's about creating a
separate one if you feel like we need to refine this process?

Cheers,
-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

---

## #62576 — Will Fitch — 2012-08-28T17:07:48+00:00

URL: https://externals.io/message/62232#62576 · In reply to: #62571

I just noticed the RFC is listed in the Accepted category.  Did something
change with the 2/3rds voting requirement?  Right now, it stands at 64% Yes.



> hi,
>
> On Tue, Aug 28, 2012 at 2:21 AM, Johannes Schlüter
> <johannes@schlueters.de> wrote:
> > […]
> before
> > […]
> some
> > […]
>
> I am not sure the usefulness of this option, but it is possible to add
> a blank field ot any vote.
>
> If the idea is to say 'I do not care enough to vote yes or no' then
> simply vote no as one obviously either did not the RFC or do not want
> it.
>
> But this is off topic again in this thread, what's about creating a
> separate one if you feel like we need to refine this process?
>
> Cheers,
> --
> Pierre
>
> @pierrejoye | http://blog.thepimp.net | http://www.libgd.org

---

## #62577 — Andrew Faulds — 2012-08-28T17:09:06+00:00

URL: https://externals.io/message/62232#62577 · In reply to: #62576

> I just noticed the RFC is listed in the Accepted category.  Did something
> change with the 2/3rds voting requirement?  Right now, it stands at 64% Yes.
I think some naughty folks might have snuck votes in after voting was 
over. It was certainly >64% when accepted.

-- 
Andrew Faulds
http://ajf.me/

---

## #62578 — Andrew Faulds — 2012-08-28T17:11:11+00:00

URL: https://externals.io/message/62232#62578 · In reply to: #62576

> I just noticed the RFC is listed in the Accepted category.  Did something
> change with the 2/3rds voting requirement?  Right now, it stands at 64% Yes.
Sorry, disregard that previous email. I didn't look at the vote before 
sending it.

If you look at the vote at the moment, it's 11 to 4, or 11/15. That is 
above 2/3rds, which is 10/15.

-- 
Andrew Faulds
http://ajf.me/

---

Next page: https://externals.io/message/62232.md?page=2
