Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109760 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 73723 invoked from network); 21 Apr 2020 20:28:50 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 21 Apr 2020 20:28:50 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 669981804B4 for ; Tue, 21 Apr 2020 12:00:18 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-vk1-f181.google.com (mail-vk1-f181.google.com [209.85.221.181]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 21 Apr 2020 12:00:17 -0700 (PDT) Received: by mail-vk1-f181.google.com with SMTP id j188so3932756vkc.2 for ; Tue, 21 Apr 2020 12:00:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=NvANqbMc6fDspmf8m5G9HY2PAJtVdXLDNrOM67N/F2E=; b=tN24il/+IHC5J4820LKdoy4YoMkY/kG1VzRL6eJUI9gtu0zB0JjEHbw6ZDRJLOT23X UEoeUJKt9fa4mCSn7XgPewg9/pnGz72f7hLaZZNUM80Io2v4FaEgKyyo3hMSKZtPlBSh vOBXOKgpp0ttZZ6Z5+uL4dO05IRYf1w8dI3RMXLTs9vZdo7V+opz1nHyeQpPZjwboDxY aPmdtNYEzQWZHdna1yFbZ8/wDPYvf+BxiYj6JQSsXQe/vSgFiUjmsJrnN3PGo+lp4iTu ox7KJSMhY1oRERA1m/EEgSR6gGYRvJKbWn4gwGtXiyBUE2vC7Uk1TlroQG/RqH0RqWGj SSIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=NvANqbMc6fDspmf8m5G9HY2PAJtVdXLDNrOM67N/F2E=; b=WGFq7KrBzH+FcffMyLr+UIRzXELs4Bym1AhgAj7KpRpRagNvD5lu+iwRt6l0smdcY+ 7/rUD5+UDmnwKvDgHnMIx5hZZYdbbbzvT7q0jiyKO9dzKjSQ09vV4155SOjOVwa1/SdQ 0qpxl8uh/3JezsgKBRYjzqtEj6ymqYJUR2ZbaA7d9wLIOIWw9egJWJ8ZQYduOiTVHrA/ 11qBq30MRFqQF2PVoOC7qx6r6DqdLOkBV4Q0yQBHXPim4GxupULGK4hEsB13+hkO0dkc DX8gD4s0DfuB4gXS0D7vU5CWHMAdG4PuNm1v8DnezGp7myFpZAhysEERRnRiR8gNoY18 xf0A== X-Gm-Message-State: AGi0PuaxNNPka4d4GFtn1hxIjf4Dq95IqQJpPxHXlbCh/JXdTNoGFwbD bdfDh9ZEdTZUaORgHCeHUTJUf4UfoZof5ppI3+5D9sx6 X-Google-Smtp-Source: APiQypL1grDbizuYfGnBsbWEjT9mqXMAaxgTEEKztJORqyjhVu2+I2Dcug7Y0z5ojzqjQesny+vcmY6P47D+sWlxZEE= X-Received: by 2002:a1f:a756:: with SMTP id q83mr16893718vke.97.1587495614237; Tue, 21 Apr 2020 12:00:14 -0700 (PDT) MIME-Version: 1.0 Date: Tue, 21 Apr 2020 15:00:03 -0400 Message-ID: To: Internals Content-Type: multipart/alternative; boundary="0000000000002b4f5405a3d1a08d" Subject: Any interest in a list type? From: matthewmatthew@gmail.com (Matthew Brown) --0000000000002b4f5405a3d1a08d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Before I create an RFC or attempt a reference implementation, is there any interest in adding (and then obviously supporting in perpetuity) a list type? The first line of PHP's documentation for "array" states: "An array in PHP is actually an ordered map". There are some optimisations that make arrays with ordered integer keys faster, but I'd be interested in a separate type dedicated to *sequential* integer keys. Such a type would presumably consume a little less memory. Why "list" and not "vec" or similar? "list" is also a reserved word =E2=80= =93 I'm imagining that you'd construct a list like $l =3D list["a", "b", "c"]; I imagine such a "list" type would be a subtype of "array" =E2=80=93 everyw= here that array was accepted, a list would be also, and it would have the same copy-on-write behaviour. If people are interested in having that type, there's a question of what to do with $some_list["a"] =3D 5; Would you convert the $some_list to an array, or throw an exception? Converting to an array would seem the more PHP-like thing to do. Similarly, the behaviour of $some_list[$key_out_of_current_range] =3D 5 would be a matter of debate too =E2=80=93 would that turn $some_list into a= n array, or would it fill up any preceding entries in the array with null? What other questions are there? Is a "list" type even a good fit for PHP, given most of its users seem pretty content with the current swiss-army-knife array type? Best wishes, Matt --0000000000002b4f5405a3d1a08d--