atom feed88 messages in net.php.lists.internalsRe: [PHP-DEV] Proposal: Array syntax
FromSent OnAttachments
53 earlier messages
Jani TaskinenNov 5, 2003 9:54 am 
Jaap van GanswijkNov 5, 2003 10:06 am 
Michael WalterNov 5, 2003 10:12 am 
Cesare D'AmicoNov 5, 2003 10:22 am 
Marco TabiniNov 5, 2003 10:28 am 
Michael WalterNov 5, 2003 10:30 am 
Michael WalterNov 5, 2003 10:35 am 
George SchlossnagleNov 5, 2003 10:36 am 
Andrei ZmievskiNov 5, 2003 10:39 am 
George SchlossnagleNov 5, 2003 10:56 am 
David EndersonNov 5, 2003 11:02 am 
Marco TabiniNov 5, 2003 11:10 am 
Shane CaraveoNov 5, 2003 11:12 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:19 pm 
Sara GolemonNov 5, 2003 2:40 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:24 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:15 am 
Ford, Mike [LSS]Nov 6, 2003 4:27 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:32 am 
Subject:Re: [PHP-DEV] Proposal: Array syntax
From:Stig S. Bakken (Stig@overture.com)
Date:Nov 6, 2003 12:58:01 am
List:net.php.lists.internals

On Wed, 2003-11-05 at 17:48, Andi Gutmans wrote:

At 11:48 AM 11/5/2003 -0500, Ilia Alshanetsky wrote:

On November 5, 2003 11:21 am, you wrote:

Well, like I said before, I am not sure this is a clear case of that. I'm probably the biggest defender around of the no-magic rule, but [] does imply something array-related to most people, so I think the magic part is much smaller than in other proposals we have seen.

Right now [] could either be an array element or an offset. Now it can either be an array element or a string offset or an attempt to create a new array. Individually it may be fine, but I am certain we'll end up with bug reports of people trying to do $a = $b[1,2,3]; (copied from your resonse ;) ) and similar. Of course someone would then want to do $a[1,2,3] = [3,4,5]; and we're happily on our road to obfuscation.

I mean c'mon, is 5 characters that much of a problem and is absolute code clarity not worth those 5 characters? Character efficiency is done in Perl, where you can do things like ~= and @_, but that makes Perl code naturally obfuscated and I do not think that's a good way to go.

I don't believe in saving characters. You probably know that I tend to prefer looooooong meaningful names and not have all sorts of magic. I think in this case, it's not a matter of saving the typing as it looks much better and IMO is more intuitive. Anyway, it's no biggy and if most people here think it shouldn't be added then that's fine with me.

I don't see a reason for introducing [] for arrays. And this is coming from the guy who came up with the original ({ }) syntax in 3.0-pre-alpha, which was replaced with array() for readability.

Let's sum up the pros and cons:

Pros: sexiness?

Cons: another BC issue, syntax obfuscation, potential grammar conflicts

I used to not like array() because it was too verbose, but today I think it's great because its meaning is very crisp and clear when you read the code. Screwing up readable syntax in favor of sexiness is Perl's business, not PHP's.

- Stig