Re: [PHP-DEV] [RFC] Data Classes

2024-11-24 Thread Larry Garfield
On Sun, Nov 24, 2024, at 8:38 AM, Rowan Tommins [IMSoP] wrote: > Hi Larry, > > I think that's a useful breakdown of the concepts involved. I don't > think it's a bad thing to have a feature that covers multiple of them - > common cases shouldn't need a long string of modifiers like "immutable >

Re: [PHP-DEV] [RFC] Data Classes

2024-11-24 Thread Niels Dossche
On 24/11/2024 12:49, Rob Landers wrote: > This isn't a race or competition, and I meant "competing with records" and > not "competing with Ilija." Though, I see how it could be interpreted that > way. Rob, You _are_ making it a race. You did the same thing to Ilija now what you tried to do to

Re: [PHP-DEV] [RFC] Data Classes

2024-11-24 Thread Rob Landers
On Sat, Nov 23, 2024, at 23:10, Ilija Tovilo wrote: > Hi Rob > > On Sat, Nov 23, 2024 at 2:12 PM Rob Landers wrote: > > > > Born from the Records RFC (https://wiki.php.net/rfc/records) discussion, I > > would like to introduce to you a competing RFC: Data Classes > > (https://wiki.php.net/rfc/d

Re: [PHP-DEV] [RFC] Data Classes

2024-11-24 Thread Rowan Tommins [IMSoP]
Hi Larry, I think that's a useful breakdown of the concepts involved. I don't think it's a bad thing to have a feature that covers multiple of them - common cases shouldn't need a long string of modifiers like "immutable copyonwrite valueequality class Point { ... }" - but being explicit abou

Re: [PHP-DEV] [RFC] Data Classes

2024-11-23 Thread Rowan Tommins [IMSoP]
On 23/11/2024 20:27, Rob Landers wrote: Interesting! I actually found it to be intuitive. Think of it like this: function increment(array $array) {   $array[0]++; } $arr = [0]; increment($arr); echo $arr[0]; // is 0 We don't expect $arr to be any different outside of the function because $ar

Re: [PHP-DEV] [RFC] Data Classes

2024-11-23 Thread Ilija Tovilo
On Sat, Nov 23, 2024 at 11:10 PM Ilija Tovilo wrote: > > On Sat, Nov 23, 2024 at 2:12 PM Rob Landers wrote: > > > > Born from the Records RFC (https://wiki.php.net/rfc/records) discussion, I > > would like to introduce to you a competing RFC: Data Classes > > (https://wiki.php.net/rfc/dataclass

Re: [PHP-DEV] [RFC] Data Classes

2024-11-23 Thread Ilija Tovilo
Hi Rob On Sat, Nov 23, 2024 at 2:12 PM Rob Landers wrote: > > Born from the Records RFC (https://wiki.php.net/rfc/records) discussion, I > would like to introduce to you a competing RFC: Data Classes > (https://wiki.php.net/rfc/dataclass). As others have pointed out, your RFC is very similar t

Re: [PHP-DEV] [RFC] Data Classes

2024-11-23 Thread Larry Garfield
On Sat, Nov 23, 2024, at 7:11 AM, Rob Landers wrote: > Hello internals, > > Born from the Records RFC (https://wiki.php.net/rfc/records) > discussion, I would like to introduce to you a competing RFC: Data > Classes (https://wiki.php.net/rfc/dataclass). > > This adds a new class modifier: data.

Re: [PHP-DEV] [RFC] Data Classes

2024-11-23 Thread Rob Landers
On Sat, Nov 23, 2024, at 18:34, Rowan Tommins [IMSoP] wrote: > On 23/11/2024 16:05, Rob Landers wrote: >>> Your RFC doesn't discuss this - the changeName example shows behaviour >>> *inside* the method, but not behaviour when *calling* it >> >> An interesting observation, can you explain more as t

Re: [PHP-DEV] [RFC] Data Classes

2024-11-23 Thread Thomas Bley
> Rob Landers hat am 23.11.2024 14:11 CET geschrieben: > > > Hello internals, > > Born from the Records RFC (https://wiki.php.net/rfc/records) discussion, I > would like to introduce to you a competing RFC: Data Classes > (https://wiki.php.net/rfc/dataclass). > > This adds a new clas

Re: [PHP-DEV] [RFC] Data Classes

2024-11-23 Thread Rowan Tommins [IMSoP]
On 23/11/2024 16:05, Rob Landers wrote: Your RFC doesn't discuss this - the changeName example shows behaviour *inside* the method, but not behaviour when *calling* it An interesting observation, can you explain more as to what you mean? Looking closer, there's a hint at what you expect to ha

Re: [PHP-DEV] [RFC] Data Classes

2024-11-23 Thread Rob Landers
On Sat, Nov 23, 2024, at 16:22, Rowan Tommins [IMSoP] wrote: > On 23/11/2024 13:11, Rob Landers wrote: >> Born from the Records RFC (https://wiki.php.net/rfc/records) discussion, I >> would like to introduce to you a competing RFC: Data Classes >> (https://wiki.php.net/rfc/dataclass). > > > Tha

Re: [PHP-DEV] [RFC] Data Classes

2024-11-23 Thread Rob Landers
On Sat, Nov 23, 2024, at 16:02, Eugene Sidelnyk wrote: > Hello > > If I remember correctly, the whole concept of "value" is fully described in > DDD book by Eric Evans. If that's the point of the RFC, I wonder of there's > any point in not making such classes immutable by default, and to keep on

Re: [PHP-DEV] [RFC] Data Classes

2024-11-23 Thread Rowan Tommins [IMSoP]
On 23/11/2024 15:02, Eugene Sidelnyk wrote: If I remember correctly, the whole concept of "value" is fully described in DDD book by Eric Evans. If that's the point of the RFC, I wonder of there's any point in not making such classes immutable by default, and to keep only one instance of value o

Re: [PHP-DEV] [RFC] Data Classes

2024-11-23 Thread Rowan Tommins [IMSoP]
On 23/11/2024 13:11, Rob Landers wrote: Born from the Records RFC (https://wiki.php.net/rfc/records) discussion, I would like to introduce to you a competing RFC: Data Classes (https://wiki.php.net/rfc/dataclass). Thank you for continuing to think about this, and PoC code is always useful to

Re: [PHP-DEV] [RFC] Data Classes

2024-11-23 Thread Eugene Sidelnyk
Hello If I remember correctly, the whole concept of "value" is fully described in DDD book by Eric Evans. If that's the point of the RFC, I wonder of there's any point in not making such classes immutable by default, and to keep only one instance of value object unique per given set of properties

[PHP-DEV] [RFC] Data Classes

2024-11-23 Thread Rob Landers
Hello internals, Born from the Records RFC (https://wiki.php.net/rfc/records) discussion, I would like to introduce to you a competing RFC: Data Classes (https://wiki.php.net/rfc/dataclass). This adds a new class modifier: data. This modifier drastically changes how classes work, making them