Re: [PHP-DEV] [RFC] Asymmetric visibility

2022-08-11 Thread Mike Schinkel
> On Aug 11, 2022, at 7:38 PM, André Hänsel wrote: > > Nicolas Grekas wrote: > >> But I'm also wondering about the use case where asymmetry would be >> useful in practice now that we have readonly? >> I voted against readonly at the time because it didn't address >> cloning, and also because it

RE: [PHP-DEV] [RFC] Asymmetric visibility

2022-08-11 Thread André Hänsel
Nicolas Grekas wrote: > But I'm also wondering about the use case where asymmetry would be > useful in practice now that we have readonly? > I voted against readonly at the time because it didn't address > cloning, and also because it deprives end-users vs code authors IMHO > (alike "final"). I w

Re: [PHP-DEV] [Concept] Extension methods

2022-08-11 Thread Alex Wells
> On 11 Aug 2022, at 22:02, Larry Garfield wrote: > > On Thu, Aug 11, 2022, at 1:59 PM, Alex Wells wrote: > Well, pipe operator is another option, but it’s got it’s downsides compared to extension methods: - it's less versatile: extension methods are required to specify a

Re: [PHP-DEV] [Concept] Extension methods

2022-08-11 Thread Alex Wells
> On 11 Aug 2022, at 21:58, Larry Garfield wrote: > > On Thu, Aug 11, 2022, at 1:51 PM, Alex Wells wrote: > >> The pipe operator RFC has actually been mentioned before; the short >> takeway is: pipe operator works and has a benefit of using existing >> functions. The downside is that those

Re: [PHP-DEV] [Concept] Extension methods

2022-08-11 Thread Larry Garfield
On Thu, Aug 11, 2022, at 1:59 PM, Alex Wells wrote: >>> Well, pipe operator is another option, but it’s got it’s downsides >>> compared to extension methods: >>> - it's less versatile: extension methods are required to specify a >>> type they’re extending, meaning they are methods, not functions

Re: [PHP-DEV] [Concept] Extension methods

2022-08-11 Thread Alex Wells
> On 11 Aug 2022, at 21:42, Larry Garfield wrote: > > On Thu, Aug 11, 2022, at 4:03 AM, Alex Wells wrote: > >> Besides, I believe working with existing functions is more of a problem >> than a bonus - because of the naming. You’d have to clutter your code >> with `array_map` calls, even tho

Re: [PHP-DEV] [Concept] Extension methods

2022-08-11 Thread Larry Garfield
On Thu, Aug 11, 2022, at 1:51 PM, Alex Wells wrote: > The pipe operator RFC has actually been mentioned before; the short > takeway is: pipe operator works and has a benefit of using existing > functions. The downside is that those are still functions, not methods, > meaning you’ll still be lef

Re: [PHP-DEV] [RFC] Asymmetric visibility

2022-08-11 Thread Larry Garfield
On Thu, Aug 11, 2022, at 8:48 AM, Nicolas Grekas wrote: >> Ilija Tovilo and I are happy to present the first new RFC for PHP 8.3: >> Asymmetric Visibility. >> >> https://wiki.php.net/rfc/asymmetric-visibility >> >> Details are in the RFC, but it's largely a copy of Swift's support for the >> same.

Re: [PHP-DEV] [Concept] Extension methods

2022-08-11 Thread Alex Wells
> On 11 Aug 2022, at 17:25, Christian Schneider wrote: > > Am 11.08.2022 um 11:03 schrieb Alex Wells : >> That’s just a concept. I’d love to bring a lot more examples in an RFC if >> there’s more positive than negative feedback. Again, I’m more looking for >> feedback than trying to convince

Re: [PHP-DEV] [Concept] Extension methods

2022-08-11 Thread Larry Garfield
On Thu, Aug 11, 2022, at 4:03 AM, Alex Wells wrote: > Besides, I believe working with existing functions is more of a problem > than a bonus - because of the naming. You’d have to clutter your code > with `array_map` calls, even though it could easily be shortened to > `map`. A couple of trivi

Re: [PHP-DEV] [Concept] Extension methods

2022-08-11 Thread Alex Wells
> On 11 Aug 2022, at 18:10, Rowan Tommins wrote: > > On 11/08/2022 10:03, Alex Wells wrote: >> You could argue the problem is that all of these are single-liners, so here >> are the same examples, but multiline formatted: > > > When people talk about avoiding one-liners, they're not just ta

Re: [PHP-DEV] [Concept] Extension methods

2022-08-11 Thread Rowan Tommins
On 11/08/2022 10:03, Alex Wells wrote: You could argue the problem is that all of these are single-liners, so here are the same examples, but multiline formatted: When people talk about avoiding one-liners, they're not just talking about whitespace, but other refactoring. For example, introd

Re: [PHP-DEV] [Concept] Extension methods

2022-08-11 Thread Christian Schneider
Am 11.08.2022 um 11:03 schrieb Alex Wells : > That’s just a concept. I’d love to bring a lot more examples in an RFC if > there’s more positive than negative feedback. Again, I’m more looking for > feedback than trying to convince someone, but I’ll showcase a couple real > comparisons for some c

Re: [PHP-DEV] Re: [Concept] Extension methods

2022-08-11 Thread Larry Garfield
On Thu, Aug 11, 2022, at 3:05 AM, Rowan Tommins wrote: > On 11/08/2022 01:10, Larry Garfield wrote: >> Would it be OK if extension methods came*before* normal methods? > > > It would certainly be possible, and seems more logical than allowing > extensions to over-ride __call but not anything else

Re: [PHP-DEV] [RFC] Asymmetric visibility

2022-08-11 Thread Nicolas Grekas
> Ilija Tovilo and I are happy to present the first new RFC for PHP 8.3: > Asymmetric Visibility. > > https://wiki.php.net/rfc/asymmetric-visibility > > Details are in the RFC, but it's largely a copy of Swift's support for the > same. > Thank you Larry and Ilija for this RFC. After reading it, I

Re: [PHP-DEV] [Concept] Extension methods

2022-08-11 Thread Alex Wells
> On 11 Aug 2022, at 07:36, Paul Crovella wrote: > > This isn't impossible. There's nothing stopping an IDE from seeing > `$collection->` and suggesting/completing that with `map($collection, ` - > they just don't right now. Offhand I don't see why this would be more > difficult for them to

Re: [PHP-DEV] Re: [Concept] Extension methods

2022-08-11 Thread Rowan Tommins
On 11/08/2022 01:10, Larry Garfield wrote: Would it be OK if extension methods came*before* normal methods? It would certainly be possible, and seems more logical than allowing extensions to over-ride __call but not anything else. It does lead to a very different feature, though: it means t