atom feed88 messages in net.php.lists.internalsRE: [PHP-DEV] Proposal: Array syntax
FromSent OnAttachments
39 earlier messages
Ford, Mike [LSS]Nov 5, 2003 9:09 am 
Marco TabiniNov 5, 2003 9:18 am 
Romans MalinovskisNov 5, 2003 9:19 am 
Andi GutmansNov 5, 2003 9:20 am 
StephNov 5, 2003 9:25 am 
Andrey HristovNov 5, 2003 9:25 am 
Ilia AlshanetskyNov 5, 2003 9:25 am 
Marco TabiniNov 5, 2003 9:30 am 
Derick RethansNov 5, 2003 9:33 am 
George SchlossnagleNov 5, 2003 9:36 am 
Rasmus LerdorfNov 5, 2003 9:45 am 
Edin KadribasicNov 5, 2003 9:45 am 
Romans MalinovskisNov 5, 2003 9:48 am 
Moriyoshi KoizumiNov 5, 2003 9:51 am 
Jani TaskinenNov 5, 2003 9:54 am 
Jaap van GanswijkNov 5, 2003 10:07 am 
Michael WalterNov 5, 2003 10:12 am 
Cesare D'AmicoNov 5, 2003 10:22 am 
Marco TabiniNov 5, 2003 10:29 am 
Michael WalterNov 5, 2003 10:30 am 
Michael WalterNov 5, 2003 10:36 am 
George SchlossnagleNov 5, 2003 10:37 am 
Andrei ZmievskiNov 5, 2003 10:39 am 
George SchlossnagleNov 5, 2003 10:56 am 
David EndersonNov 5, 2003 11:03 am 
Marco TabiniNov 5, 2003 11:11 am 
Shane CaraveoNov 5, 2003 11:13 am 
Michael WalterNov 5, 2003 12:26 pm 
Greg MacLellanNov 5, 2003 12:40 pm 
Robert CummingsNov 5, 2003 1:08 pm 
David EndersonNov 5, 2003 1:20 pm 
Sara GolemonNov 5, 2003 2:41 pm 
George SchlossnagleNov 5, 2003 3:00 pm 
Wez FurlongNov 5, 2003 4:06 pm 
Christian SchneiderNov 5, 2003 5:07 pm 
Ard BiesheuvelNov 5, 2003 5:27 pm 
Christian SchneiderNov 5, 2003 5:50 pm 
Andi GutmansNov 6, 2003 12:03 am 
Stig S. BakkenNov 6, 2003 12:58 am 
Kouber SaparevNov 6, 2003 1:25 am 
Mike RobinsonNov 6, 2003 3:31 am 
Andi GutmansNov 6, 2003 4:04 am 
Ford, Mike [LSS]Nov 6, 2003 4:09 am 
Alexey TrunyovNov 6, 2003 4:16 am 
Ford, Mike [LSS]Nov 6, 2003 4:28 am 
Sascha SchumannNov 6, 2003 4:30 am 
Andi GutmansNov 6, 2003 5:28 am 
Sascha SchumannNov 6, 2003 5:46 am 
Stig S. BakkenNov 6, 2003 6:33 am 
Subject:RE: [PHP-DEV] Proposal: Array syntax
From:David Enderson (DEnd@DigitalIMS.com)
Date:Nov 5, 2003 11:03:16 am
List:net.php.lists.internals

I have read all the debate on this and found it very interesting. You guys were generating comments faster than I could read them! lol.

I have used PHP constantly for 2 years. Most of that time has been spent using arrays very extensively and often as function parameters. For what my vote is worth, I strongly favor the newly suggested notation (+1).

I'm not going to try to restate all the pros discussed and address all the cons. I prefer not to have multiple ways to do things and I found the list() function to be very counter-intuitive. I was thrilled when foreach() came out and deprecated while(), list(), each() syntax.

Typing "array()" isn't very many more letters, that's true, but I type it A LOT! lol. I sometimes use it as a parameter, and VERY often have to use it to initialize variables before doing array_push() or setting array items inside loops. Using: $a = []; would be wonderful and much less clunky.

As far as extending the syntax to the list() command...well...I would prefer to just find a way to deprecate it entirely, but that is probably not possible. So I guess even though it would seem to make sense I would have to vote against that because it SETS the values of its "parameters".

Yes, it may be the way another language does it. All languages borrow from others, as recent discussions regarding foreach() and {} demonstrate.

I believe the ultimate goal of PHP is to have a "quick and dirty" language that is easy to read, use, and learn. While Rasmus's comment about no-magic made me stop and examine this for a while, I believe it fits all those goals nicely and is an elegant reason to make an exception to the no-magic rule.

No, I don't want to see stuff like:

if ([1][0] == 1) {

but as someone pointed out, you can make anything look nasty in C-syntax derived languages.

--David