On Tue, February 6, 2007 8:17 am, LAUPRETRE François (P) wrote:
>> From: Richard Lynch
>>
>> How many newbies will be trying:
>> array[1, 2, 3];
>> and left scratching their heads when it doesn't work?
>
> Yes, even if I am in favor of the [] syntax, it is a good argument:
> 'array[ 1, 2, 3]' can
> become a very common error, and not especially among newbies!
>
> Maybe I am wrong, but would it be possible to accept all these
> syntaxes :
>
> array(1, 2, 3)  (RHS only)
> [ 1, 2, 3 ]     (RHS=array / LHS=list, I especially like: '$x = [ $a,
> $b ] = f()' :)
> list($a, $b)    (LHS only)
> array[1, 2, 3]  (RHS only)
>
> For this purpose, we could say that the [] notation is optionally
> preceded by 'array'.
>
> Another idea if you want to make it easier to understand for newbies:
> make array() and list()
> synonyms, so that array() behaves as list() when LHS, and list()
> behaves as array() when RHS.
> IMHO, it would become simpler to explain.
>
> If we implement both, we can even suppport 'list[ 1, 2, 3 ]'. How can
> we be more permissive?

I probably needn't even post this, but:

-1

Having even more ways to do everything is just confusing, not handy.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to