Re: [PHP-DEV] RFC: Records

2024-11-21 Thread Rob Landers
On Sun, Nov 17, 2024, at 08:21, Larry Garfield wrote: > I would far prefer assembling record-ish behavior myself, using the smaller > parts above. Eg: > > final readonly data class Point(int $x, int $y); > > "final" prevents extension. "readonly" makes it immutable. "data" gives it > value-p

Re: [PHP-DEV] RFC: Records

2024-11-19 Thread Larry Garfield
On Tue, Nov 19, 2024, at 5:56 AM, Michał Marcin Brzuchalski wrote: > Hi Larry, > > niedz., 17 lis 2024 o 08:24 Larry Garfield > napisał(a): >> ... >> I can see the benefit of an inline constructor. Kotlin has something >> similar. But I can see the benefit of it for all classes, even service

Re: [PHP-DEV] RFC: Records

2024-11-19 Thread Michał Marcin Brzuchalski
Hi Larry, niedz., 17 lis 2024 o 08:24 Larry Garfield napisał(a): > ... > I can see the benefit of an inline constructor. Kotlin has something > similar. But I can see the benefit of it for all classes, even service > classes, not just records. (In Kotlin, it's used for service classes all > t

Re: [PHP-DEV] RFC: Records

2024-11-19 Thread Michał Marcin Brzuchalski
Hi Rob and Ilia Thank you both for your detailed proposals and the efforts you put into shaping this important feature for PHP It is clear a lot of thought has gone into both approaches and I appreciate the opportunity to share my thoughts. niedz., 17 lis 2024 o 01:17 Ilija Tovilo napisał(a): >

Re: [PHP-DEV] RFC: Records

2024-11-17 Thread Rowan Tommins [IMSoP]
Hi Rob, I'm torn on this one. On the one hand, it does look like a nice solution for adding custom value objects to the language; on the other hand, it's a lot of things that are "just slightly different" for users to get used to. On 17/11/2024 21:30, Rob Landers wrote: One of the main reaso

Re: [PHP-DEV] RFC: Records

2024-11-17 Thread Rob Landers
Hello Ilija and Larry, You both touch upon some interesting and similar thoughts, and it may be worth sharing how I arrived here; at least so we have some shared context: Personally, I feel that classes are quite bloated with features and what feature works with what is quite confusing for new

Re: [PHP-DEV] RFC: Records

2024-11-16 Thread Larry Garfield
On Sat, Nov 16, 2024, at 5:14 PM, Rob Landers wrote: > Hello internals, > > I'm ready as I'm going to be to introduce to you: "Records" > https://wiki.php.net/rfc/records! > > Records allow for a lightweight syntax for defining value objects. > These are superior to read-only classes due to havin

Re: [PHP-DEV] RFC: Records

2024-11-16 Thread Ilija Tovilo
Hi Rob On Sun, Nov 17, 2024 at 12:15 AM Rob Landers wrote: > > Hello internals, > > I'm ready as I'm going to be to introduce to you: "Records" > https://wiki.php.net/rfc/records! Thanks for your proposal. I very much agree that value semantics are a highly desirable feature. I sent out my con

[PHP-DEV] RFC: Records

2024-11-16 Thread Rob Landers
Hello internals, I'm ready as I'm going to be to introduce to you: "Records" https://wiki.php.net/rfc/records! Records allow for a lightweight syntax for defining value objects. These are superior to read-only classes due to having value semantics and far less boilerplate, for most things deve