atom feed88 messages in net.php.lists.internalsRe: [PHP-DEV] Proposal: Array syntax
FromSent OnAttachments
33 earlier messages
Jani TaskinenNov 5, 2003 8:59 am 
Christian SchneiderNov 5, 2003 9:00 am 
Ford, Mike [LSS]Nov 5, 2003 9:01 am 
Marco TabiniNov 5, 2003 9:01 am 
Marco TabiniNov 5, 2003 9:05 am 
Ford, Mike [LSS]Nov 5, 2003 9:08 am 
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 
5 later messages
Subject:Re: [PHP-DEV] Proposal: Array syntax
From:Marco Tabini (mar@tabini.ca)
Date:Nov 5, 2003 10:29:10 am
List:net.php.lists.internals

Michael Walter wrote:

$a = [1,2,$b[11]];

Is that confusing enough for you? ;-)

What's confusing about it?

The fact that $b[11] references an item of an array, while [1,2,$b[11]] assigns values to the array $a. The fact that you (and, probably, most of us) can't tell right off the bat is a clear sign that this is a bad idea, because it's ambiguous and confusing.

The same line using the current syntax, btw, would have looked like this:

$a = array (1,3,$b[11]);

Actually, $a = [1,2,$b[11]] would be amazingly clear and expressive in comparison with the rather verbose array() version (same thing with the swap, btw).

I guess we'll have to agree to disagree :)

$a = [1,2,$b[11]] is semantically inconsistent.

As you can see the ambiguity is gone--square brackets are used for one purpose and nothing else.

Actually, do you realize that you use () both for "grouping" and for application? I can't see anything wrong with using square brackets for array element access and array creation, to be honest.

Actually, no, I don't. I'm not sure what "grouping" and "application" mean...

Mt.