Re: Proposal: Array syntax

From: Date: Thu, 06 Nov 2003 00:06:30 +0000
Subject: Re: Proposal: Array syntax
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-5275@lists.php.net to get a copy of this message
> Anyway, it's no biggy and if most people here think it shouldn't be added > then that's fine with me. Thies reminded me of something that should be considered here; we talked about and alternative array syntax for overloaded objects where all the array indices are required in one "chunk" to be able to resolve an overloaded array lookup. eg: in COM, if you have a 2-Dimensional SafeArray, and you want to lookup an element, you need to provide both dimension offsets at the same time. $foo = $arr[0][1]; This cannot be acheived with the current breadcumb evaluation used by the engine, as the engine will try to resolve $tmp = $arr[0]; $foo = $tmp[1]; One of the possible solutions was the pascal style array indexing: $foo = $arr[0,1]; If we overload [] too much, we really will end up with unmaintainable code. I'm -1 on the alternative array declaration syntax unless we implement the pascal syntax (or something else useful!) for ZE2 OO handlers, in which case I'm -0. --Wez.

« previous php.internals (#5275) next »