Re: Introducing "Array Of" RFC

From: Date: Sat, 18 Jan 2014 12:36:08 +0000
Subject: Re: Introducing "Array Of" RFC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  Groups: php.internals 
Request: Send a blank email to internals+get-71241@lists.php.net to get a copy of this message
On 18 Jan 2014 03:53, "Julien Pauli" <jpauli@php.net> wrote: > I'm in favor of designing a new "typed array" structure , instead of > adding a new syntax that checks things at runtime of every function > call, mainly by iterating over the array at runtime. This, while useful, doesn't solve the same problem as this RFC is solving. You wouldn't be able to type hint for the type contained within the structure without some form of new syntax. What if we did both? So that the new syntax actually expects an SplTypedArray (or whatever you want to call it) and if an instance of this structure is passed the class entry attached to the structure can be used as an O(1) shortcut, but if an array is passed it is run through SplTypedArray::fromArray(), allowing users to pass an array and take the performance hit if they want to. Thanks, Chris

« previous php.internals (#71241) next »