Re: Pseudo-objects (methods on arrays, strings, etc.)
| From: | Andrew Faulds | Date: | Tue, 17 Jul 2012 10:30:55 +0000 |
| Subject: | Re: Pseudo-objects (methods on arrays, strings, etc.) | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-61343@lists.php.net to get a copy of this message | ||
I might not have made it clear, but the main reasons I want it are:
- Chance to clean up array/string/etc APIs
- Looks nicer IMO, slightly clearer what functions do and affect
On Jul 17, 2012 11:21 AM, "Gustavo Lopes" <glopes@nebm.ist.utl.pt> wrote:
> 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
>