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

2025-03-01 Thread Alwin Garside
On 1 Mar 2025, at 08:37, Rob Landers wrote: > > Hi Alwin, > > You may be interested in http://wiki.php.net/rfc/records, whose goal from the > beginning was a new type that behaved like arrays (value semantics, copy on > write) as well as the ability to attach behavior to them. > > I’ve since

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