atom feed88 messages in net.php.lists.internalsRE: [PHP-DEV] Proposal: Array syntax
FromSent OnAttachments
19 earlier messages
Christian SchneiderNov 5, 2003 7:34 am 
Nicolas ToperNov 5, 2003 7:47 am 
Ilia AlshanetskyNov 5, 2003 7:56 am 
Antony DovgalNov 5, 2003 8:04 am 
Rasmus LerdorfNov 5, 2003 8:21 am 
Christian SchneiderNov 5, 2003 8:30 am 
Andrey HristovNov 5, 2003 8:40 am 
Ilia AlshanetskyNov 5, 2003 8:48 am 
Andi GutmansNov 5, 2003 8:48 am 
Jani TaskinenNov 5, 2003 8:50 am 
Ford, Mike [LSS]Nov 5, 2003 8:51 am 
Marco TabiniNov 5, 2003 8:52 am 
Christian SchneiderNov 5, 2003 8:55 am 
George SchlossnagleNov 5, 2003 8:58 am 
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 
19 later messages
Subject:RE: [PHP-DEV] Proposal: Array syntax
From:Steph (step@virgin.net)
Date:Nov 5, 2003 9:25:42 am
List:net.php.lists.internals

OK .. I'm a wobbler.

I think it would be cool to have the cleaner alternative syntax; I think I'd use it *in some situations and not others*, and I think that that in itself would make my code virtually unmaintainable by anyone else.

As Andi originally said, having more than one way to do things isn't always a good thing.

Add me to the -1 list. Even tho' it's a cool idea.

-----Original Message----- From: Christian Schneider [mailto:csch@cschneid.com] Sent: 04 November 2003 23:33 To: inte@lists.php.net Subject: [PHP-DEV] Proposal: Array syntax

I propose to add an alternative (backward compatible) short array creation syntax: $a = [ 1, 2, 3 ]; and $a = [ 'a' => 42, 'b' => "foo" ];

It can also be used in function calls: img(['src' => "logo.gif", 'alt' => "Logo"]);

Reason behind this change: Arrays are used a lot and should therefore have as little syntactic overhead as possible. And I think the short syntax is also easier to read and write.

A patch for the parser is trivial and is attached for Zend2.

Note: I checked the newsgroup archive but couldn't find a discussion about this. After not hearing back about my proposed enhancement to debug_backtrace() and the dangling comma for function call parameters being rejected I wonder if I'm using the right mailing list for this :-)