Re: Pseudo-objects (methods on arrays, strings, etc.)
| From: | Stas Malyshev | Date: | Wed, 18 Jul 2012 16:35:07 +0000 |
| Subject: | Re: Pseudo-objects (methods on arrays, strings, etc.) | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-61411@lists.php.net to get a copy of this message | ||
Hi!
> enough but I don't know the Zend engine well enough). This way we can
> have array->key, array->sort(TYPE), etc. for new code to use, instead of
> the legacy array and string method mess (the latter needs a cleanup more
> in particular).
The mess does not exist because we have array_key() instead of
array->key(). There's nothing wrong with having array_key(). The mess
exists because functions do not form single API with single principle
behind it, but were added in ad-hoc manner, sometimes without
correlating them with others. So, if you want to clean it up, you'd want
to write a plan how new API would look like and how it will be better
than old one. If the solution is "let's use ->" then it's not worth it.
The solution that's worth it is "let's have this better API" and that's
where we should start, not with changing array_key() to array->key() and
saying "now we have clean sexy API".
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227