Re: Pseudo-objects (methods on arrays, strings, etc.)

From: Date: Tue, 17 Jul 2012 10:21:28 +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-61341@lists.php.net to get a copy of this message
On Tue, 17 Jul 2012 12:07:09 +0200, Pierre Joye wrote:
On Tue, Jul 17, 2012 at 2:12 AM, Gustavo Lopes <glopes@nebm.ist.utl.pt> wrote:
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 isn't a difference in terms of making PHP more object oriented, which was the main advantage advanced by the OP. I'm all for redesigning strings/arrays APIs (presented as an afterthought by the OP), but for that the discussion should be centered on what those APIs will look like, not the syntax one uses to call them. In fact, quite frequently, syntax discussions make more important design decisions be ignored (see namespaces).
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.
-- Gustavo Lopes

« previous php.internals (#61341) next »