Re: Proposal: Array syntax

From: Date: Wed, 05 Nov 2003 10:07:06 +0000
Subject: Re: Proposal: Array syntax
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-5200@lists.php.net to get a copy of this message
Andi Gutmans wrote:
I guess I think it'd be interesting to see what other's think. Also, another point to check is if list() can also be converted into [] because having a hybrid wouldn't be too nice.
Having list() work the same way would be very sexy indeed: [$a, $b] = [$b, $a]; To be honest I never really liked the distinction between list() and array(). Using [] for arrays is also consistent with dereferenceing arrays and therefore shouldn't confuse people really. My first shot at extending the parser to allow [] for list() failed though as both T_LIST and T_ARRAY are used in expr_without_variable. But I'm sure you could find a clever way around this, my knowledge of yacc is still limited :-) But even without [] for list() I think [] for array() would be nice ;-) - Chris

« previous php.internals (#5200) next »