Re: [PHP-DEV] Vibe check: array shapes

2025-02-28 Thread Rob Landers
On Fri, Feb 28, 2025, at 23:52, Alwin Garside wrote: > Hello, > > Long time listener, first time caller here. > > Last week I had a shower thought about how it would be neat if we could > declare array shapes in PHP, and use them to provide structural interfaces > for arrays. > > After all,

Re: [PHP-DEV] Vibe check: array shapes

2025-02-28 Thread Dmitry Derepko
Hi! > However, arrays are very ergonomic to work with, especially for passing along > a list of properties, which is why many frameworks and libraries still use > them I am not agree that arrays must be typed in this way. They won’t be this arrays as they are. Instead this week I’ve started

Re: [PHP-DEV] Vibe check: array shapes

2025-02-28 Thread Alwin Garside
On 1 Mar 2025, at 00:28, Larry Garfield wrote: > Your friends are correct. Arrays in PHP are an awful thing. They are twice > as memory hungry as objects, they provide no static guarantees, and they're a > security hole waiting to happen (and has in fact happened). > > And since PHP 8.0, *we

Re: [PHP-DEV] Vibe check: array shapes

2025-02-28 Thread Alwin Garside
On 1 Mar 2025, at 00:28, Tim Düsterhus wrote: > >> Anyway, I would love to try and push this idea forward – either by >> contacting Kacpar, or writing my own RFC – and have a shot at implementing a >> proof of concept, but first I would like to get a feel for whether this >> proposal would fin

Re: [PHP-DEV] Vibe check: array shapes

2025-02-28 Thread Alwin Garside
> On 28 Feb 2025, at 23:57, Bilge wrote: > > Generics Yes, I am aware that generics are being worked on. However, generics wouldn't provide structural interfaces for arrays. At most it would provide a way to infer/define generic types for array keys and/or values. I guess I should've provi

Re: [PHP-DEV] Vibe check: array shapes

2025-02-28 Thread Larry Garfield
On Fri, Feb 28, 2025, at 4:52 PM, Alwin Garside wrote: > Hello, > > Long time listener, first time caller here. > > Last week I had a shower thought about how it would be neat if we could > declare array shapes in PHP, and use them to provide structural > interfaces for arrays. > > After all, arr

Re: [PHP-DEV] Vibe check: array shapes

2025-02-28 Thread Tim Düsterhus
Hi On 2/28/25 23:52, Alwin Garside wrote: Anyway, I would love to try and push this idea forward – either by contacting Kacpar, or writing my own RFC – and have a shot at implementing a proof of concept, but first I would like to get a feel for whether this proposal would find much footing he

Re: [PHP-DEV] Vibe check: array shapes

2025-02-28 Thread Bilge
Generics On Fri, 28 Feb 2025, 22:55 Alwin Garside, wrote: > Hello, > > Long time listener, first time caller here. > > Last week I had a shower thought about how it would be neat if we could > declare array shapes in PHP, and use them to provide structural interfaces > for arrays. > > After all,

[PHP-DEV] Vibe check: array shapes

2025-02-28 Thread Alwin Garside
Hello, Long time listener, first time caller here. Last week I had a shower thought about how it would be neat if we could declare array shapes in PHP, and use them to provide structural interfaces for arrays. After all, arrays are one of PHPs strongest features, and anyone who has ever tried

Re: [PHP-DEV] Enums should implement Stringable interface by default

2025-02-28 Thread Larry Garfield
On Fri, Feb 28, 2025, at 10:11 AM, Rowan Tommins [IMSoP] wrote: > On 28/02/2025 08:33, Janis Kajaks wrote: >> My suggestion is that all enums (both basic/pure and backed) should >> implement Stringable interface by default, > > > This has come up at least twice before: > > * https://externals.io/m

Re: [PHP-DEV] Enums should implement Stringable interface by default

2025-02-28 Thread Rowan Tommins [IMSoP]
On 28/02/2025 08:33, Janis Kajaks wrote: My suggestion is that all enums (both basic/pure and backed) should implement Stringable interface by default, This has come up at least twice before: * https://externals.io/message/118040 * https://externals.io/message/124991 These threads also touch

Re: [PHP-DEV] [RFC] [Discussion] Add WHATWG compliant URL parsing API

2025-02-28 Thread Rob Landers
On Fri, Feb 28, 2025, at 09:38, Lynn wrote: > > > On Fri, Feb 28, 2025 at 12:05 AM Rob Landers wrote: >> __ >> >> >> On Thu, Feb 27, 2025, at 22:01, Faizan Akram Dar wrote: >>> Hi, >>> >>> >>> On Thu, 27 Feb 2025, 20:55 Paul M. Jones, wrote: > On Feb 25, 2025, at 09:55, ignace

Re: [PHP-DEV] [RFC] [Discussion] Add WHATWG compliant URL parsing API

2025-02-28 Thread Lynn
On Fri, Feb 28, 2025 at 12:05 AM Rob Landers wrote: > > > On Thu, Feb 27, 2025, at 22:01, Faizan Akram Dar wrote: > > Hi, > > > On Thu, 27 Feb 2025, 20:55 Paul M. Jones, wrote: > > > > On Feb 25, 2025, at 09:55, ignace nyamagana butera > wrote: > > > > The problem with your suggestion is that t

[PHP-DEV] Enums should implement Stringable interface by default

2025-02-28 Thread Janis Kajaks
Hi, I'm writing this email with a reference to https://wiki.php.net/rfc/howto. My suggestion is that all enums (both basic/pure and backed) should implement Stringable interface by default, and before you say that it's totally wrong or impossible let me explain why. Let's say I have a backed enum: