Re: [PHP-DEV] A little syntactic sugar on array_* function calls?

This is only part of a thread. view whole thread
May 28, 2021 22:11 (Hendra Gunawan)

> > The only correct way to resolve this issue is to not support mutable operations. >
Correct me if I'm wrong: scalar object will hit memory limit earlier than old API if it applied to $some_huge_shared_array for several method calls.
> > I don't think there's much need for mutable operations. sort() and shuffle() would be best implemented by returning a new array instead. array_push() is redundant with $array[]. array_shift() and array_unshift() should never be used. array_pop() and array_splice() are the only sensible mutable array methods that come to mind, and I daresay we can do without them. >
Suppose that we all agree with that. **Will scalar object preserve most of all functionality of the old API?** Some functions are very handy that keep us away from the gory detail implementation. In array case, we know that PHP array is a combination of array and plain object in JS term. There is a trend in user land PHP library that they are just copying the JS array API and poorly preserving the existing functionality of PHP old API. Implicitly, the author of this thread wants this to happen. If I am not wrong, scalar object date back to before PHP 7.0. Is there any consideration why scalar object was not escalated to the next phase, say to RFC? Regards Hendra Gunawan.