Re: [PHP-DEV] Re: Adding `final class Deque` to PHP

2022-02-02 Thread tyson andre
Hi Larry Garfield, > >> Returning $this would resolve that, I think.  (Making it return a new, > >> immutable copy of the Deque would be even nicer, but I realize that's > >> probably not an argument I'm going to win at this point on this RFC.) > > > > Technically, you still can have single-expr

Re: [PHP-DEV] Re: Adding `final class Deque` to PHP

2022-02-02 Thread tyson andre
Hi Jordan, > > 4.  Returning $this makes code easier to write at some cost to readability > > - Developers new to php or using `Collections\Deque` for the first time > > would not immediately know what the code they're reading is doing. > >    (less of a problem with a good IDE, typechecker, and

Re: [PHP-DEV] Re: Adding `final class Deque` to PHP

2022-02-02 Thread Jordan LeDoux
On Wed, Feb 2, 2022 at 6:59 AM tyson andre wrote: > > 4. Returning $this makes code easier to write at some cost to readability > - Developers new to php or using `Collections\Deque` for the first time > would not immediately know what the code they're reading is doing. >(less of a problem w

Re: [PHP-DEV] Re: Adding `final class Deque` to PHP

2022-02-02 Thread Larry Garfield
On Wed, Feb 2, 2022, at 8:59 AM, tyson andre wrote: > Hi Larry Garfield, >> Returning $this would resolve that, I think. (Making it return a new, >> immutable copy of the Deque would be even nicer, but I realize that's >> probably not an argument I'm going to win at this point on this RFC.) > >

Re: [PHP-DEV] Adding `final class Deque` to PHP

2022-02-02 Thread tyson andre
Hi Stephen, > As a userland dev & library author it’s nice to see some progression on basic > data structures, so thank you for your efforts on this! > > > Two little things in the RFC: > > The proposed API switches between terms `front`, `back`, `start` and `end` in > comments - is there mea

Re: [PHP-DEV] Re: Adding `final class Deque` to PHP

2022-02-02 Thread tyson andre
Hi Larry Garfield, > Request: > > push() and unshift() currently return void. That's not helpful. It would be > vastly more useful if they both returned $this. Not as much for chaining, > but more so that you can add a value to a queue and pass it as an argument to > another call (often recu

Re: [PHP-DEV] Adding `final class Deque` to PHP

2022-02-02 Thread tyson andre
Hi Mel Dafert, > >The proposed API switches between terms `front`, `back`, `start` and `end` > >in comments - is there meant to be a conceptual difference between > >front/start and end/back ? > > On a similar note, why are the methods for getting the first/last value called > `top()`/`bottom()