Re: re: removing an item from an array
| From: | Yasuo Ohgaki | Date: | Tue, 21 Aug 2012 23:00:08 +0000 |
| Subject: | Re: re: removing an item from an array | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-62378@lists.php.net to get a copy of this message | ||
2012/8/22 Levi Morrison <morrison.levi@gmail.com>:
>> Why did you change the equivalent code?
>> array_walk is the best(fast and memory efficient) way
>> to delete elements.
>>
>> This code may be refereed from old PHP users, therefore
>> we should write better code.
>>
>> If you don' t have good reason to do so, please revert
>> the change.
>
> The implementation you had may be faster, but that is certainly NOT
> what matters as long as both are correct. What matters in the RFC is
> clarity. You have already said that too many people don't know about
> array_walk, so why would they understand array_delete in terms of
> array_walk? Please do not revert the change as what I have written is
> more clear.
I don't say array_walk() is difficult, but people out there
just don't know it.
Why we should use inefficient example for internals?
Besides, if array_walk() is used, people who would like
to write patch for it will knew that most of code can be
borrowed from array_walk().
Thus, it may prevent reinventing wheel.
> The reason speed doesn't matter in behavior example is that once it is
> implemented in C it will be just as fast as array_walk, perhaps it
> will even be faster.
I cannot agree to this opinion.
I still think the example should be reverted.
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net