Re: Concept: "arrayable" pseudo type and \Arrayable interface
| From: | Peter Bowyer | Date: | Mon, 18 Nov 2019 08:38:51 +0000 |
| Subject: | Re: Concept: "arrayable" pseudo type and \Arrayable interface | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-107817@lists.php.net to get a copy of this message | ||
On Sun, 17 Nov 2019 at 23:44, Ben Ramsey <ben@benramsey.com> wrote:
>
> > On Nov 17, 2019, at 17:28, Mike Schinkel <mike@newclarity.net> wrote:
> >
> > If we are going to open up arrays for enhancement in PHP 8 I would ask
> that we seriously consider addressing the various differences between a
> built-in array and an instance of ArrayObject and/or the related associated
> interfaces such that the objects can be used interchangeably with a
> built-in array
>
> I completely agree. I would love to see anything implementing ArrayAccess
> able to be used in any of the array functions.
>
> This might be a way-out-in-left-field concept, but if we went down this
> path, perhaps a PHP array could become an object internally (i.e.,
> ArrayObject) without changing the way it works in existing code? Then,
> if/when generics are introduced, a PHP array would already be a class to
> which a generic type parameter could be applied.
I agree with Mike & Ben. Another voice in support of this.
Peter