Re: Pseudo-objects (methods on arrays, strings, etc.)
| From: | Andrew Faulds | Date: | Tue, 17 Jul 2012 10:15:52 +0000 |
| Subject: | Re: Pseudo-objects (methods on arrays, strings, etc.) | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-61340@lists.php.net to get a copy of this message | ||
I think strings are even more important, they have an even messier API than
arrays.
On Jul 17, 2012 11:07 AM, "Pierre Joye" <pierre.php@gmail.com> wrote:
> hi,
>
> On Tue, Jul 17, 2012 at 2:12 AM, Gustavo Lopes <glopes@nebm.ist.utl.pt>
> wrote:
>
> > Let's ignore empty arguments like "make[s] PHP feel modern". That aside,
> the
> > main argument advanced in this message makes no sense.
>
> This idea has been proposed many times in the past and it is actually
> a very good proposal, for array, string or other types.
>
> The only reason why it is not yet implemented is the technical
> complexity to do it. We need pseudo objects and the likes, and it is
> really not something easy to do, in an efficient enough way.
>
> > Adding method call
> > syntax to arrays hardly makes PHP more object oriented. Syntax is
> > unimportant. There's no substantial difference between array_slice($arr,
> > ...) and $arr->slice(...).
>
> There is a huge difference. One of the main difference would be to
> finally have an uniform API and not this painful inconsistent APIs we
> have to maintain.
>
> > There is, in my opinion, *one* merit here -- redesigning -- and perhaps
> > reimplementing -- the arrays functions API. This will require a lot of
> work,
> > thought, and time tough.
>
> Yes, but long due, same for strings.
>
> Cheers,
> --
> Pierre
>
> @pierrejoye | http://blog.thepimp.net |
> http://www.libgd.org
>