Re: [PHP-DEV] State of Generics and Collections

2024-08-27 Thread Derick Rethans
On 27 August 2024 22:02:45 BST, Rob Landers wrote: >On Tue, Aug 27, 2024, at 22:15, Bilge wrote: >> On 26/08/2024 23:24, Rob Landers wrote: >>> On Sun, Aug 25, 2024, at 22:28, Gina P. Banyard wrote: >>> For the past 2–3 months, you have sent the vast majority of emails on this list, th

Re: [PHP-DEV] State of Generics and Collections

2024-08-27 Thread Rob Landers
On Tue, Aug 27, 2024, at 22:15, Bilge wrote: > On 26/08/2024 23:24, Rob Landers wrote: >> On Sun, Aug 25, 2024, at 22:28, Gina P. Banyard wrote: >> >>> For the past 2–3 months, you have sent the vast majority of emails on this >>> list, this is not what I would consider normal >> >> To understan

Re: [PHP-DEV] State of Generics and Collections

2024-08-27 Thread Bilge
On 26/08/2024 23:24, Rob Landers wrote: On Sun, Aug 25, 2024, at 22:28, Gina P. Banyard wrote: For the past 2–3 months, you have sent the vast majority of emails on this list, this is not what I would consider normal To understand just how bad I was breaking this rule, I created https://emai

Re: [PHP-DEV] State of Generics and Collections

2024-08-26 Thread Rob Landers
On Sun, Aug 25, 2024, at 22:28, Gina P. Banyard wrote: > On Friday, 23 August 2024 at 23:55, Rob Landers wrote: >> On Fri, Aug 23, 2024, at 23:06, Larry Garfield wrote: >>> >>> With generics, the syntax isn't the hard part. The hard part is type >>> inference, or accepting that generic-using co

Re: [PHP-DEV] State of Generics and Collections

2024-08-25 Thread Morgan
To throw one more question into the pot, I'd like to raise the possibility of wanting typedefs. (To use the old C/C++ term, the latter also allows a "type alias" syntax that does much the same thing.) To use an example from the blog post: function f(List> $entries): Map {...} there need not b

Re: [PHP-DEV] State of Generics and Collections

2024-08-25 Thread Larry Garfield
On Mon, Aug 19, 2024, at 12:08 PM, Derick Rethans wrote: > Hi! > > Arnaud, Larry, and I have been working on an article describing the > state of generics and collections, and related "experiments". > > You can find this article on the PHP Foundation's Blog: > https://thephp.foundation/blog/2024/0

Re: [PHP-DEV] State of Generics and Collections

2024-08-25 Thread Gina P. Banyard
On Friday, 23 August 2024 at 23:55, Rob Landers wrote: > On Fri, Aug 23, 2024, at 23:06, Larry Garfield wrote: >> With generics, the syntax isn't the hard part. The hard part is type >> inference, or accepting that generic-using code will just be extraordinarily >> verbose and clumsy. There is

Re: [PHP-DEV] State of Generics and Collections

2024-08-23 Thread Rob Landers
On Fri, Aug 23, 2024, at 23:06, Larry Garfield wrote: > On Fri, Aug 23, 2024, at 1:38 PM, Rob Landers wrote: > > On Fri, Aug 23, 2024, at 20:27, Bruce Weirdan wrote: > >> On Fri, Aug 23, 2024 at 4:27 PM Larry Garfield > >> wrote: > >>> Moving those definitions to attributes is certainly possible,

Re: [PHP-DEV] State of Generics and Collections

2024-08-23 Thread Roman Pronskiy
On Fri, Aug 23, 2024 at 4:31 PM Larry Garfield wrote: > > The null option is always an option, yes. The thing to understand is that > today, *we already have erased generics*, via PHPStan/Psalm. That's one > reason I am, personally, against erased generics in the language proper. > They don'

Re: [PHP-DEV] State of Generics and Collections

2024-08-23 Thread Larry Garfield
On Fri, Aug 23, 2024, at 1:38 PM, Rob Landers wrote: > On Fri, Aug 23, 2024, at 20:27, Bruce Weirdan wrote: >> On Fri, Aug 23, 2024 at 4:27 PM Larry Garfield >> wrote: >>> Moving those definitions to attributes is certainly possible, though AFAIK >>> both the PHPStan and Psalm devs have expresse

Re: [PHP-DEV] State of Generics and Collections

2024-08-23 Thread Rob Landers
On Mon, Aug 19, 2024, at 19:08, Derick Rethans wrote: > Hi! > > Arnaud, Larry, and I have been working on an article describing the > state of generics and collections, and related "experiments". > > You can find this article on the PHP Foundation's Blog: > https://thephp.foundation/blog/2024/08

Re: [PHP-DEV] State of Generics and Collections

2024-08-23 Thread Rob Landers
On Fri, Aug 23, 2024, at 20:27, Bruce Weirdan wrote: > On Fri, Aug 23, 2024 at 4:27 PM Larry Garfield wrote: >> Moving those definitions to attributes is certainly possible, though AFAIK >> both the PHPStan and Psalm devs have expressed zero interest in it. >> Part of the challenge is that such

Re: [PHP-DEV] State of Generics and Collections

2024-08-23 Thread Bruce Weirdan
On Fri, Aug 23, 2024 at 4:27 PM Larry Garfield wrote: > Moving those definitions to attributes is certainly possible, though AFAIK > both the PHPStan and Psalm devs have expressed zero interest in it. > Part of the challenge is that such an approach will either still involve > string parsing, T

Re: [PHP-DEV] State of Generics and Collections

2024-08-23 Thread Larry Garfield
On Fri, Aug 23, 2024, at 6:48 AM, Roman Pronskiy wrote: > On Mon, Aug 19, 2024 at 7:11 PM Derick Rethans wrote: >> >> Arnaud, Larry, and I have been working on an article describing the >> state of generics and collections, and related "experiments". >> >> You can find this article on the PHP Foun

Re: [PHP-DEV] State of Generics and Collections

2024-08-23 Thread Larry Garfield
On Fri, Aug 23, 2024, at 4:58 AM, Kévin Dunglas wrote: > Thanks for sharing this research work. > > Instead of having to choose between fully reified generics and erased > type declarations, couldn't we have both? A new option in php.ini could > allow to enable the “erased” mode as a performance,

Re: [PHP-DEV] State of Generics and Collections

2024-08-23 Thread Deleu
On Fri, Aug 23, 2024 at 8:51 AM Roman Pronskiy wrote: > > Do you consider the path of not adding generics to the core at all? In > fact, this path is implicitly taken during the last years. So maybe it > makes sense to enforce that status quo? > > Potential steps: > - Make the current status quo

Re: [PHP-DEV] State of Generics and Collections

2024-08-23 Thread Roman Pronskiy
On Mon, Aug 19, 2024 at 7:11 PM Derick Rethans wrote: > > Arnaud, Larry, and I have been working on an article describing the > state of generics and collections, and related "experiments". > > You can find this article on the PHP Foundation's Blog: > https://thephp.foundation/blog/2024/08/19/stat

Re: [PHP-DEV] State of Generics and Collections

2024-08-23 Thread Kévin Dunglas
Thanks for sharing this research work. Instead of having to choose between fully reified generics and erased type declarations, couldn't we have both? A new option in php.ini could allow to enable the “erased” mode as a performance, production-oriented optimization. In development, and on projects

Re: [PHP-DEV] State of Generics and Collections

2024-08-21 Thread Mike Schinkel
> On Aug 20, 2024, at 9:44 AM, Arnaud Le Blanc wrote: > > Hi Mike, > > On Tue, Aug 20, 2024 at 2:45 AM Mike Schinkel wrote: >> It seems Java-style Generics are viewed as the proper archetype for Generics >> in PHP? I would challenge the wisdom of taking that road considering how >> different

Re: [PHP-DEV] State of Generics and Collections

2024-08-20 Thread Jordan LeDoux
On Tue, Aug 20, 2024 at 6:02 AM Arnaud Le Blanc wrote: > Hi Bob, > > On Tue, Aug 20, 2024 at 12:18 AM Bob Weinand wrote: > > The fluid Arrays section says "A PoC has been implemented, but the > performance impact is still uncertain". Where may I find that PoC for my > curiosity? I'm imagining th

Re: [PHP-DEV] State of Generics and Collections

2024-08-20 Thread Bob Weinand
Hey Arnauld, On 20.8.2024 15:01:28, Arnaud Le Blanc wrote: Hi Bob, On Tue, Aug 20, 2024 at 12:18 AM Bob Weinand wrote: The fluid Arrays section says "A PoC has been implemented, but the performance impact is still uncertain". Where may I find that PoC for my curiosity? I'm imagining the impl

Re: [PHP-DEV] State of Generics and Collections

2024-08-20 Thread Arnaud Le Blanc
Hi Larry, On Tue, Aug 20, 2024 at 3:32 AM Larry Garfield wrote: > > In fact, generic traits (essentially statically replacing the generic > > arguments at link-time) would be an useful feature which would remain > > useful even if we had fully reified generics. > > I recognize that some functiona

Re: [PHP-DEV] State of Generics and Collections

2024-08-20 Thread Arnaud Le Blanc
Hi Mike, On Tue, Aug 20, 2024 at 2:45 AM Mike Schinkel wrote: > It seems Java-style Generics are viewed as the proper archetype for Generics > in PHP? I would challenge the wisdom of taking that road considering how > different the compilers and runtimes are between the Java and PHP. PHP > s

Re: [PHP-DEV] State of Generics and Collections

2024-08-20 Thread Arnaud Le Blanc
Hi Bob, On Tue, Aug 20, 2024 at 12:18 AM Bob Weinand wrote: > The fluid Arrays section says "A PoC has been implemented, but the > performance impact is still uncertain". Where may I find that PoC for my > curiosity? I'm imagining the implementation of the array types as a counted > collection

Re: [PHP-DEV] State of Generics and Collections

2024-08-20 Thread Rob Landers
On Tue, Aug 20, 2024, at 14:08, Arnaud Le Blanc wrote: > Hi Rob, > > On Mon, Aug 19, 2024 at 7:51 PM Rob Landers wrote: > > > > Invariance would make arrays very difficult to adopt, as a library can > > > not start type hinting generic arrays without breaking user code, and > > > users can n

Re: [PHP-DEV] State of Generics and Collections

2024-08-20 Thread Arnaud Le Blanc
Hi Rob, On Mon, Aug 19, 2024 at 7:51 PM Rob Landers wrote: > > Invariance would make arrays very difficult to adopt, as a library can not > > start type hinting generic arrays without breaking user code, and users can > > not pass generic arrays to libraries until they start using generic arra

Re: [PHP-DEV] State of Generics and Collections

2024-08-20 Thread Rob Landers
On Tue, Aug 20, 2024, at 03:53, Bob Weinand wrote: > On 20.8.2024 03:31:05, Larry Garfield wrote: >> On Mon, Aug 19, 2024, at 5:16 PM, Bob Weinand wrote: >> >> >>> Regarding the Collections PR, I personally really don't like it: >>> >>> • It implements something which would be trivial if we h

Re: [PHP-DEV] State of Generics and Collections

2024-08-19 Thread Bob Weinand
On 20.8.2024 03:31:05, Larry Garfield wrote: On Mon, Aug 19, 2024, at 5:16 PM, Bob Weinand wrote: Regarding the Collections PR, I personally really don't like it: • It implements something which would be trivial if we had reified generics. If this ever gets merged, and generics happen later,

Re: [PHP-DEV] State of Generics and Collections

2024-08-19 Thread Larry Garfield
On Mon, Aug 19, 2024, at 5:16 PM, Bob Weinand wrote: > Regarding the Collections PR, I personally really don't like it: > > • It implements something which would be trivial if we had reified > generics. If this ever gets merged, and generics happen later, it would > be probably outdated and qui

Re: [PHP-DEV] State of Generics and Collections

2024-08-19 Thread Mike Schinkel
> On Aug 19, 2024, at 7:37 PM, Rob Landers wrote: > As an experiment, awhile ago, I went a different route for reified generics > by 'hacking' type aliases (which I was also experimenting with). Such that a > generic becomes compiled into a concrete implementation with a dangling type > alias:

Re: [PHP-DEV] State of Generics and Collections

2024-08-19 Thread Mike Schinkel
> On Aug 19, 2024, at 1:08 PM, Derick Rethans wrote: > > Hi! > > Arnaud, Larry, and I have been working on an article describing the > state of generics and collections, and related "experiments". > > You can find this article on the PHP Foundation's Blog: > https://thephp.foundation/blog/2024

Re: [PHP-DEV] State of Generics and Collections

2024-08-19 Thread Rob Landers
On Mon, Aug 19, 2024, at 19:08, Derick Rethans wrote: > Hi! > > Arnaud, Larry, and I have been working on an article describing the > state of generics and collections, and related "experiments". > > You can find this article on the PHP Foundation's Blog: > https://thephp.foundation/blog/2024/08

Re: [PHP-DEV] State of Generics and Collections

2024-08-19 Thread Bob Weinand
On 19.8.2024 19:08:32, Derick Rethans wrote: Hi! Arnaud, Larry, and I have been working on an article describing the state of generics and collections, and related "experiments". You can find this article on the PHP Foundation's Blog: https://thephp.foundation/blog/2024/08/19/state-of-generics-

Re: [PHP-DEV] State of Generics and Collections

2024-08-19 Thread Valentin Udaltsov
On Monday, 19 of August 2024 г. at 20:11, Derick Rethans wrote: > Hi! > > Arnaud, Larry, and I have been working on an article describing the > state of generics and collections, and related "experiments". > > You can find this article on the PHP Foundation's Blog: > > https://thephp.foundation/b

Re: [PHP-DEV] State of Generics and Collections

2024-08-19 Thread Rob Landers
On Mon, Aug 19, 2024, at 19:08, Derick Rethans wrote: > Hi! > > Arnaud, Larry, and I have been working on an article describing the > state of generics and collections, and related "experiments". > > You can find this article on the PHP Foundation's Blog: > https://thephp.foundation/blog/2024/08

[PHP-DEV] State of Generics and Collections

2024-08-19 Thread Derick Rethans
Hi! Arnaud, Larry, and I have been working on an article describing the state of generics and collections, and related "experiments". You can find this article on the PHP Foundation's Blog: https://thephp.foundation/blog/2024/08/19/state-of-generics-and-collections/ cheers, Derick