Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126540 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 AD7E71A00BC for ; Sat, 1 Mar 2025 16:53:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1740847877; bh=PUlKIXDq1afx6Ja68Zx00SUZldP7JG6IdktDdBwvQZw=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=ZRcvzo1PozOlvqe0HuY+XYueuectzrZGIop/UGSW2+wlb4tEr0+GNx6pCWyQsGOmH 5vJoQtSqbQYbvXA9HeTI3FFoyGpQPj9ya4NPqF1T8N6IDPh5O8L0Lw1D2IMRAaCoQd hseozrpFT3auIIvzfQpSLk8gEVsD9Oji5rkzNEcv3o8WweCttoyJund4jiSysRnGRC erhhXaXbGZ6BO+HuKxlaJy/Y10dB9GzrjzB/qV+JP4y4P6MRwfKbBjEGCQTVkqWr66 5iQ2vyoYTTttMydx2pqyUvQk+QV7Nmrwxd4mGdNpkLgi5jOwVuOwj75gLFHGHfJpHh UhrPU405el8+g== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id F0F6C18006A for ; Sat, 1 Mar 2025 16:51:15 +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_PASS,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mr85p00im-zteg06021601.me.com (mr85p00im-zteg06021601.me.com [17.58.23.187]) (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, 1 Mar 2025 16:51:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garsi.de; s=sig1; bh=PUlKIXDq1afx6Ja68Zx00SUZldP7JG6IdktDdBwvQZw=; h=Content-Type:Mime-Version:Subject:From:Date:Message-Id:To:x-icloud-hme; b=ZpwpTZpvYQjYJQN0IrPCixb+jThuMQ7IWgBBnnH5nG5Z/EwzrOAiCW3D00oPjXk2+ yDa322Fb9eHNZ3UvAAm6J8liSo9xFUa4nCam+fiVLPFWzAuRbEqX0XDWhtnKjd7bjM lGyNnogGgMnMDU6eyMepTcDQsW34IN/VpEyU9ULt8/erd2EQm1hX5hFgG6MBi40g4S PHKKIEF5QKPNEZm0+Wb9UiJB9pa2WzWfwd7HnDIPCPlphJUhOuhbYxAVqjllOaY0qT kFDNV1mPBXXraWzPJ4GqLI7JQ6ydllSjkYk1EpnJAgfGMwItY7bmc0ncidmqTxb90L xS8He9G83ijwQ== Received: from smtpclient.apple (mr38p00im-dlb-asmtp-mailmevip.me.com [17.57.152.18]) by mr85p00im-zteg06021601.me.com (Postfix) with ESMTPSA id 8C9A830584EE; Sat, 1 Mar 2025 16:53:50 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.400.131.1.6\)) Subject: Re: [PHP-DEV] Vibe check: array shapes In-Reply-To: <15994089-a8cb-4909-8f6c-b679b88efaab@app.fastmail.com> Date: Sat, 1 Mar 2025 17:53:10 +0100 Cc: PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: <51D666D0-039A-4260-A61B-192B7D3F8E63@garsi.de> References: <81F87FFD-91EF-4FDF-A929-9BE1CA08AA1E@garsi.de> <15994089-a8cb-4909-8f6c-b679b88efaab@app.fastmail.com> To: Rob Landers X-Mailer: Apple Mail (2.3826.400.131.1.6) X-Proofpoint-GUID: 8gsbOToMbIUcaaNQraqqoWYbBA_OjvNU X-Proofpoint-ORIG-GUID: 8gsbOToMbIUcaaNQraqqoWYbBA_OjvNU X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-01_07,2025-02-28_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 mlxlogscore=602 suspectscore=0 clxscore=1030 bulkscore=0 malwarescore=0 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2503010137 From: alwin@garsi.de (Alwin Garside) On 1 Mar 2025, at 08:37, Rob Landers wrote: >=20 > Hi Alwin, >=20 > 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. >=20 > I=E2=80=99ve since abandoned it due to the poor reception it got on = the list and decided to pursue inner classes instead. However, I spent = nearly a year thinking through that RFC, so feel free to pick my brain = via email, or a call.=20 >=20 > The first implementation didn=E2=80=99t use classes at all, instead = were implemented on arrays and enforced an array shape. This meant that = records were a subtype of arrays (so you could pass a record as an = argument in lieu of an array). This worked pretty well, but feedback I = got from colleagues challenged me to add the ability for behavior. So, I = had to abandon that implementation. So, if you look at that RFC and = remove all the behavior, you=E2=80=99re basically left with a record = keyword and the ability to specify types and props.=20 >=20 > The biggest challenges with that implementation (and array shapes in = general), happen to be around WHEN to do type checking and how to get a = handle on references. Further, there=E2=80=99s quite a few parts of php = that reach into the implementation of arrays and do something different = than the canonical implementation (opcache, is a good example here) that = can end up breaking things in fun ways. Particularly if you somehow end = up with one of these in one of the magic global arrays. >=20 > Anyway, best of luck to you and don=E2=80=99t hesitate to reach out! >=20 > =E2=80=94 Rob Hey Rob, I did stumble upon your Records RFC at some point, but I felt it tries = to solve a different problem, because it provides a nominal interface = rather than a structural interface like I have in mind, never mind = behavior. But thanks either way for offering your help! I might contact you just = to ask some things about the internals of PHP, mostly out of curiosity. = :-) Alwin=