Re: [PHP-DEV] Regarding array_shift()/array_unshift()

2021-06-03 Thread Mike Schinkel
> On Jun 3, 2021, at 5:31 AM, Lauri Kenttä wrote: > > On 2021-06-03 01:59, Mike Schinkel wrote: >> 1.) Given Nikita's position that it would only be viable to offer a >> syntax that simulates method calling for arrays if the methods >> themselves are immutable can you envision a solution for allo

Re: [PHP-DEV] Regarding array_shift()/array_unshift()

2021-06-03 Thread Jordi Boggiano
Hah, I sure did not expect my answer to trigger these 5 complex RFCs worth of work ;) On 03/06/2021 00:59, Mike Schinkel wrote: 4.) Given Nikita's comments on the O() performance of array_shift() have you considered instead simulating a FIFO queue using an array as a stack? Any reason tha

Re: [PHP-DEV] Regarding array_shift()/array_unshift()

2021-06-03 Thread Lauri Kenttä
On 2021-06-03 01:59, Mike Schinkel wrote: 1.) Given Nikita's position that it would only be viable to offer a syntax that simulates method calling for arrays if the methods themselves are immutable can you envision a solution for allowing $array->shift() functionality that would address getting b

Re: [PHP-DEV] Regarding array_shift()/array_unshift()

2021-06-02 Thread Larry Garfield
On Wed, Jun 2, 2021, at 6:15 PM, Mike Schinkel wrote: > > On Jun 2, 2021, at 7:07 PM, Larry Garfield wrote: > > > > On Wed, Jun 2, 2021, at 5:59 PM, Mike Schinkel wrote: > >>> On Jun 2, 2021, at 4:25 AM, Jordi Boggiano wrote: > > > >>> IMO for unshift() it'd be fine to return a new array, but w

Re: [PHP-DEV] Regarding array_shift()/array_unshift()

2021-06-02 Thread Mike Schinkel
> On Jun 2, 2021, at 7:07 PM, Larry Garfield wrote: > > On Wed, Jun 2, 2021, at 5:59 PM, Mike Schinkel wrote: >>> On Jun 2, 2021, at 4:25 AM, Jordi Boggiano wrote: > >>> IMO for unshift() it'd be fine to return a new array, but when processing a >>> list of things in a FIFO pattern I often use

Re: [PHP-DEV] Regarding array_shift()/array_unshift()

2021-06-02 Thread Larry Garfield
On Wed, Jun 2, 2021, at 5:59 PM, Mike Schinkel wrote: > > On Jun 2, 2021, at 4:25 AM, Jordi Boggiano wrote: > > IMO for unshift() it'd be fine to return a new array, but when processing a > > list of things in a FIFO pattern I often used array_shift() to get the > > first "job" out of the array

Re: [PHP-DEV] Regarding array_shift()/array_unshift()

2021-06-02 Thread Mike Schinkel
> On Jun 2, 2021, at 4:25 AM, Jordi Boggiano wrote: > > On 02/06/2021 00:34, Mike Schinkel wrote: >> But from all this I do agree with you that just returning an array would >> likely be acceptable. >> - >> >> This would not be a great solution for really large arrays, but then we >> can't

Re: [PHP-DEV] Regarding array_shift()/array_unshift()

2021-06-02 Thread Jordi Boggiano
On 02/06/2021 00:34, Mike Schinkel wrote: But from all this I do agree with you that just returning an array would likely be acceptable. - This would not be a great solution for really large arrays, but then we can't eliminate the need for a developer to have a reasonable level of knowledg

[PHP-DEV] Regarding array_shift()/array_unshift()

2021-06-01 Thread Mike Schinkel
Hi Nikita, >> On May 28, 2021, at 10:31 AM, Nikita Popov > > wrote: > >> 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_shi