Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127532 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 lists.php.net (Postfix) with ESMTPS id ABEC81A00BC for ; Mon, 2 Jun 2025 13:45:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1748871813; bh=oemRj9hbtLeVGxLnKFU1IGoV44bqPgJ5Wa3FsSXfiXs=; h=Date:From:To:In-Reply-To:References:Subject:From; b=S82VS2U5KndQUGmnkBVIZ1K5SldO2Ms83oQAcL8KSq878iooS2SBu8tF+1ui7r2/E zXOZlTCuwvYuX4nqH2XbZkK8Eps9u8hEvSdqu6OwN9nyeJGkvfh5lX6TTS4IeXLEC2 TA5ERgwz9xXgYgOWkd8AuWdbLPl8B5kQcB7Zg6AytcBQYw947haQmDRdPDK4DPl5Ee ywsxsQ43+Qtuoh9uorhU/U7dhUjmzBXexSDZ0JF4MbGvgWb8KzgfkRoBCOPlDke/rO 94na3cdLRtoY2ys+9W58Qejl3Kr5j12ZXeAudwWtMuR+h+3Ll0l6Sbl8pbwUOgkqMQ SezvQdvG9Tryw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 482A4180042 for ; Mon, 2 Jun 2025 13:43:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from fout-a7-smtp.messagingengine.com (fout-a7-smtp.messagingengine.com [103.168.172.150]) (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 ; Mon, 2 Jun 2025 13:43:33 +0000 (UTC) Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfout.phl.internal (Postfix) with ESMTP id 48AF01380344 for ; Mon, 2 Jun 2025 09:45:37 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-10.internal (MEProxy); Mon, 02 Jun 2025 09:45:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding: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=fm1; t=1748871937; x=1748958337; bh=2f6IJexxOhoxQHkrJjI/I R1noN/AhGBP/1BKOueIi1E=; b=lwPTU3HqJZpIj2W6GJ1C8TVegP/8Hsl0w7r7X 2fWkDLz/T9vKtDwc+T42zFn21mesk9D2zaU9GyuFJ3KyqG7N+8ducONYRn3mgXB6 AvtCLSRS28OPFZdMUYOPvKlnxaOW3QsSVyCGp31QpORSkaUhqPOTA6zemrniKAX7 BaVnyActskVIffORANQOjPW/i5WJPhr4uJ4otIuLhFB1xG5s/c+uRhHsiBkoDAJo KQgcPOvCoU1wVustkcxZ24y+RlHfP9s9HuoAHJ0q+iTMJDHtk4G0dkBWCCYF9vpu ZnGt8FdL3+ZIjpyQSGbt0QQlM/6cf7HZD1hIOZOkRMFYZ4M7A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding: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=1748871937; x=1748958337; bh=2 f6IJexxOhoxQHkrJjI/IR1noN/AhGBP/1BKOueIi1E=; b=dlxuMWRq52nwRAHOO gdJKTUa+i2ZPY8GDEOjuwSSDWQbdJbI6ZO3J6sGlg1fyahqU/xmgRb49JGb3spZO ErkH/PqScF7lzUbZTzVk2MIlitJZ9LkMcOWKsKdMFSNnodZ2/RRuWpDbRJFDrozq 1JZIlLQXJgiBOyOTxmKpV1rwuTuupNLti/XVrqMlV3/GefcqVbU6eUNn8BjHoUtz K83QYIfTrCCxdh6V3i/w3Mbbfv1ufbt0PIcYcBYHHhBYSnIKpMZr06Dj3rUIpBQL KDf/MtM00YgaDEuuDGGCzov73vaAUUqqPgYovZhHyMijz8JHDsLkiJutj60h0x8m AUNlA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddtgdefjeekfeculddtuddrgeefvddrtd dtmdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggft fghnshhusghstghrihgsvgdpuffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftd dtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefoggffhffvkfgj fhfutgfgsehtqhertdertdejnecuhfhrohhmpedfnfgrrhhrhicuifgrrhhfihgvlhgufd cuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomheqnecuggftrfgrthhtvghr nheptddttdefvdegledvvdetgfevhfekvefhheeikedugefgieeghfefudfhteegteekne cuffhomhgrihhnpehthhgvphhhphdrfhhouhhnuggrthhiohhnnecuvehluhhsthgvrhfu ihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlh guthgvtghhrdgtohhmpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdp rhgtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id F33F1700060; Mon, 2 Jun 2025 09:45:36 -0400 (EDT) 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 X-ThreadId: T46b75b8a3226f3e0 Date: Mon, 02 Jun 2025 08:45:16 -0500 To: "php internals" Message-ID: <80c31a58-c3ca-4c39-92a6-4df479ac53ba@app.fastmail.com> In-Reply-To: References: <78B00771-EAA7-4191-8B34-C6FAA53B6B66@rwec.co.uk> Subject: Re: [PHP-DEV] [RFC] Add preserve_key_types to array_keys() to prevent unintended int conversion Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Mon, Jun 2, 2025, at 3:20 AM, =E9=A9=AC=E6=AD=A3=E5=BC=BA wrote: > Hi Rowan, =20 > > Thank you for the clear technical guidance. I agree we've reached a=20 > consensus that implementing a native Map type would be the proper=20 > solution to this long-standing issue. =20 > > To move forward, I'd like to clarify a few practical aspects: =20 > > 1. **RFC Proposal** =20 > - Should I initiate an RFC draft at this stage? =20 > - If yes, would you recommend starting with an "idea" thread on=20 > internals@lists.php.net first? =20 > > 2. **Implementation Resources** =20 > - Given my limited experience with PHP core development: =20 > - What would be the minimal viable prototype to demonstrate=20 > feasibility? =20 > - Are there active contributors you could refer who might be=20 > interested in collaborating? =20 > > 3. **Interim Steps** =20 > - Would it help to: =20 > - Compile real-world use cases from major frameworks? =20 > - Benchmark existing userland implementations (e.g., DS\Map)? =20 > > I'm committed to driving this improvement and willing to coordinate=20 > non-code efforts. Your advice on the most effective next steps would b= e=20 > invaluable. =20 > > Best regards, =20 > [xiaoma]=20 There's been a fair amount of discussion in the past, and I am 100% in f= avor of splitting list/sequence, set, and map types into separate types.= However, there's some challenges to doing so, mainly around, of course= , type variance and generics. See: https://thephp.foundation/blog/2024/08/19/state-of-generics-and-collecti= ons/#full-reified-generics (The "Collections" section, specifically, and the link to my research do= cument.) Gina is working hard on an associated types RFC ("generics junior"), whi= ch would obviate the need for any custom syntax there. That would actua= lly allow doing *most* of the collection implementation in user-space; t= he missing parts would be operators and being able to use more efficient= C implementations. If Gina's RFC passes (it's not yet proposed, unfort= unately), I intend to try and write user-space versions to flesh out the= design if nothing else. Ideally I'd love for that to turn into an RFC = in the future, but the bar for that is of course higher, and we'll have = to see what else happens in the mean time. I don't mean to dissuade you from looking into the topic; I just want yo= u to be aware of the prior art so that we don't end up with multiple con= flicting half-baked approaches instead of a single fully baked approach. --Larry Garfield