Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126035 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 3319A1A00BD for ; Sat, 23 Nov 2024 16:05:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1732378088; bh=z5MBbEm6LwHngTgUan8MqWmZH47VjgIsYZYRCLL/wnc=; h=Date:From:To:In-Reply-To:References:Subject:From; b=CcFeN6iL7GRdMR9npcMjbQZQrao5+bRpcqZXJdWiKnyuWfYBc1ZXrR9bJXbKs+JMw BjUGkUxtKEycqZP4N4C1reGPHPZ1EB0GyE7YaWDIR7zspOmuI7jOBGPpMuMis/ruce ithUhe9TR/84qy1D2jCVYtuSoseL6fbcNM4TH/UNBlkBBQ9oLg1h6NI1B77fTAc1f1 vX3QsUCxPSlZ9tVqo+zBhwNT0XXPpxU4jUFShhIiChWAErekCsisAvJKkSB63Rr9zf N6eCuUcZUWgiPEL0XEVSxiYpjV9R8AcotHeQ9Say1IxLYR6tNrZKg+T9EuWF6r76Gn yZuC1x2cLhv+w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E98451801DF for ; Sat, 23 Nov 2024 16:08:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-b4-smtp.messagingengine.com (fhigh-b4-smtp.messagingengine.com [202.12.124.155]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 23 Nov 2024 16:08:06 +0000 (UTC) Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfhigh.stl.internal (Postfix) with ESMTP id 0EFC2254008C for ; Sat, 23 Nov 2024 11:05:25 -0500 (EST) Received: from phl-imap-09 ([10.202.2.99]) by phl-compute-01.internal (MEProxy); Sat, 23 Nov 2024 11:05:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1732377924; x=1732464324; bh=h6J5Jn/FcS KsBvWrKaktv4poStDwGVWmgdjG1AX40vA=; b=i36kDN1L5keBaO/MFV92G8zn8x nyv5VbYuPyllIO2NwXyAzQJB7BW0pJQWQLt4ieMuQy8XXv6nv1BVG5plrp138yfH mYmTHOe1EXy/l+3fVQDjjWUFc4wf8gsSYR0MOPNpXt1quOdArTOUT6VI1XaWb/xD xSpjbUWAIIQTBmvwKOqXDtNiEOtwi5bJDRZz/zwCoRGaII+WOC4snsJXiRwnfE/p jWb/KzBcje0TSaNUY1ZqmS8JYHXmBwcUvpFsdneO1JVbto9sZsEaSEFNynT6e2LF kKvhKlWmyt/1S83rFD7CPpThd6db0aYCczp38sF9MKQAwTMQzCOyNR/82UpA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1732377924; x=1732464324; bh=h6J5Jn/FcSKsBvWrKaktv4poStDwGVWmgdj G1AX40vA=; b=VXbiOdBjPVX2hB2M1cWsP8cvXxVQU6JkeEPBZslY+yVrGq2XfQq +Sy0X82a5oF6067KjV71l1EbvL1dccH8OBpAU7qXSvas5c6+fG5QwTO6N7GpiiP+ f8+SYVGoFNvixV0W4JxtYa5Srddn6851Sfr5SxvItMoqy3lzsJ1ovQUW7nhjgMsy ilbdFHlBaVrichpTQFqR525I3XZk8rpXNFHFJXGNBffdHub2bGfZvxgh3mle2emh mVWUOMQejbiIUyXoc8d4lylTG9++1GVi7nj9L00a8HSMCj8QOaBHjQF5+Fy8tJ3t hyj3Uwx8HEYMRlSZdH1jpIkMNg1/F9bPfvQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrgedugdekgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhepofggfffhvf fkjghfufgtsegrtderreertdejnecuhfhrohhmpedftfhosgcunfgrnhguvghrshdfuceo rhhosgessghothhtlhgvugdrtghouggvsheqnecuggftrfgrthhtvghrnhepgeekgfffte evveekueelheelieduheejfffhudetieegfedviefhhfeugeeiudefnecuffhomhgrihhn pehphhhprdhnvghtpdgvgihtvghrnhgrlhhsrdhiohdpghhithhhuhgsrdgtohhmnecuve hluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprhhosgessgho thhtlhgvugdrtghouggvshdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouh htpdhrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 98A1A780069; Sat, 23 Nov 2024 11:05:24 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Sat, 23 Nov 2024 17:05:04 +0100 To: internals@lists.php.net Message-ID: <0b87a3eb-7e63-4e28-a11d-25824e240a73@app.fastmail.com> In-Reply-To: <163a08c1-2279-4a3f-a1bb-8cdfe406a4ba@rwec.co.uk> References: <18b85ba5-5f1c-489c-9096-3ae203977fbe@app.fastmail.com> <163a08c1-2279-4a3f-a1bb-8cdfe406a4ba@rwec.co.uk> Subject: Re: [PHP-DEV] [RFC] Data Classes Content-Type: multipart/alternative; boundary=cd5b58dd656a462fbffec40706c225da From: rob@bottled.codes ("Rob Landers") --cd5b58dd656a462fbffec40706c225da Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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) discussi= on, I would like to introduce to you a competing RFC: Data Classes (http= s://wiki.php.net/rfc/dataclass). >=20 >=20 > Thank you for continuing to think about this, and PoC code is always u= seful to work through the implications. >=20 > It seems like this is going in a very similar direction to the work Il= ija shared in April: https://externals.io/message/122845 and https://git= hub.com/php/php-src/pull/13800 >=20 > My knowledge of the engine isn't good enough to compare the two PRs, b= ut the descriptions seem very similar. The main differences seem to be d= etails mentioned in one draft and not the other: >=20 >=20 > - You have described details for constructors and inheritance, which I= lija left as open questions > - Ilija had considered how instance methods should behave, proposing a= "mutating" keyword and "!" call-site marker. Your RFC doesn't discuss t= his - the changeName example shows behaviour *inside* the method, but no= t behaviour when *calling* it >=20 > Is it just an oversight that you didn't link to the previous discussio= n, or had you not realised how similar the proposals would end up? Eithe= r way, this looks like ripe ground for collaboration, unless there is so= me fundamental disagreement about the approach. >=20 >=20 >=20 > --=20 > Rowan Tommins > [IMSoP] Yes, this is mostly about "composability" vs. dedicated syntax. A bare "= data class" is very similar to struct while a "final readonly data class= " is very similar to records. > Is it just an oversight that you didn't link to the previous > discussion, or had you not realised how similar the proposals > would end up? Yes, it is an oversight! I didn't even think to link to it. To be fair, = I also didn't link to the records RFC. I've updated the RFC with links. = While some behavior is similar to what Ilija described, it is mostly a n= atural progression of adding a `data` modifier to classes. There's no sp= ecial syntax because classes already have a well-defined syntax. > 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? Th= e changeName example is simply about constructors=E2=80=94whose behavior= is mostly due to engine limitations. You can't very easily see what hap= pens inside a constructor from outside a constructor (usually). =E2=80=94 Rob --cd5b58dd656a462fbffec40706c225da Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On Sat, Nov = 23, 2024, at 16:22, Rowan Tommins [IMSoP] wrote:
On 23= /11/2024 13:11, Rob Landers wrote:
Bo= rn from the Records RFC (https://wiki.php.net/rfc/records)=0A= discussion, I would like to introduce to you a competing RFC:=0A= Data Classes (https://wiki.php.net/rfc/dataclass).=


Thank you for continuing to think a= bout this, and PoC code is=0A always useful to work through the imp= lications.

It seems like this is going in a very similar direc= tion to the=0A work Ilija shared in April: https://exter= nals.io/message/122845 and https://github.com/php/p= hp-src/pull/13800

My knowledge of the engine isn't good en= ough to compare the two=0A PRs, but the descriptions seem very simi= lar. The main differences=0A seem to be details mentioned in one dr= aft and not the other:

- You have described details f= or constructors and inheritance,=0A which Ilija left as open questi= ons
- Ilija had considered how instance methods should be= have,=0A proposing a "mutating" keyword and "!" call-site marker. Y= our RFC=0A doesn't discuss this - the changeName example shows beha= viour=0A *inside* the method, but not behaviour when *calling* it

Is it just an oversight that you didn't link to the pr= evious=0A discussion, or had you not realised how similar the propo= sals=0A would end up? Either way, this looks like ripe ground for=0A= collaboration, unless there is some fundamental disagreement about= =0A the approach.


--=20=0ARowan Tommins=0A[IMSoP]
=
Yes, this is mostly about "composability" vs. dedicated s= yntax. A bare "data class" is very similar to struct while a "final= readonly data class" is very similar to records.

Is it just an oversight that you didn't= link to the previous
      discu= ssion, or had you not realised how similar the proposals
      woul= d end up?

Yes, it is an oversi= ght! I didn't even think to link to it. To be fair, I also didn't link t= o the records RFC. I've updated the RFC with links. While some behavior = is similar to what Ilija described, it is mostly a natural progress= ion of adding a `data` modifier to classes. There's no special syntax be= cause classes already have a well-defined syntax.

Your RFC
  &nbs= p;   doesn't discuss this - the changeName example shows behav= iour
  &nb= sp;   *inside* the method, but not behaviour when *calling* it=

An interesting observation, c= an you explain more as to what you mean? The changeName example is simpl= y about constructors=E2=80=94whose behavior is mostly due to engine limi= tations. You can't very easily see what happens inside a constructor fro= m outside a constructor (usually).

=E2=80=94 Rob
--cd5b58dd656a462fbffec40706c225da--