Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112613 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 6900 invoked from network); 23 Dec 2020 18:46:07 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Dec 2020 18:46:07 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 159961804B1 for ; Wed, 23 Dec 2020 10:19:07 -0800 (PST) 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.8 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11olkn2108.outbound.protection.outlook.com [40.92.18.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 23 Dec 2020 10:19:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VRlaNJe3ELEkYyDtaa8yGVvuSIFMQSNdDOYbH994cS78Z7pUGoHgTjScsGvOvdKyFzI+xakjcjMXmrFUM+j4bopJoYth41Ql1VWLJkyH9lx1V4ZewWYVyxV6bOQgdAzzCb5WEx1K7tVRjWBJEWFwjoG3mI60xnk9x4BiOxbfXzPFInGEVJgzZSVWApTDUXnPFgQ69aTI4Q5118argn7jeL7K8inU74UKa1+es3ZcacZHVoN7nMn85D/lXQy1AMQRRB3eAA2Uw9OfPndpJ6iB5GICdtYywaKajKUgIjn75Ni5nuYMa4DPgizkVuAt+RPdgOoGx4HyYyJWr729qC2elQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JA6CzWRPb4N706DpUvOoKoyGpyYSi5Z/tFfvaLxwljE=; b=NdfrNGXx1zfZfvXJ1YidL9F+aqTwrDibRsPqBHyT5bv3F9a9ajCUhxnFPXZL+oz2r65oCn+9EAlCOL8R+YjnbhZhSP214ftsYxcKte4ntIcV3PKAMRKJBvgzgQhCpC7iVPxJXxBT0a9OvksKFAJNvDsECE3SX/z0FTnM6U06Qn5v0gFIM20vLdQNj28w9MQtxamsuKjAD5bw+CEo7yMKJAGKkhzvL+Aqyh8Bd53f5PsF2uGu2KiUGB6WmBXyI+NE6d3hYoaCdf/bGApH7TT0AfhEnsz8pbtbv2ZCSwoFcjAuWYiyCbGe7KvD1H9/F/ttGML8tjnWA/xDXE/gmJLlDg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JA6CzWRPb4N706DpUvOoKoyGpyYSi5Z/tFfvaLxwljE=; b=Q2bibgpzrtNttmdVTI1EmJTno3/axI6kXdVecex0/VHCS5WJ7v10iUp148sf2tFy0qcMfCFNXKN82t/BDjgyQwcIFJNIWh393N8+Aooy0GK8+3uDLItNaZ0HlXEG+4CFIigGG9+HnnwP0JRT3YHYs7M+2lqoRS76iN6ld/ziC9goNALMGLpYDBAU8rzc27jD/MPTGywly4U1ADPvw8btPQfcbLvg8s1+DRT4ZZjwd76yrDSGKaQFKwwwc/IxBOdQt2F5044KzYhDf+X5JmCEuE5Ec/A4OvRZGVuM33Qk7D+hnOSt5QwG9DS7WjGeA4DK5eIoofVUAg3vf+hyffAn5A== Received: from BN8NAM11FT041.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4b::40) by BN8NAM11HT013.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4b::269) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3676.25; Wed, 23 Dec 2020 18:19:04 +0000 Received: from DM6PR07MB6618.namprd07.prod.outlook.com (2a01:111:e400:fc4b::4e) by BN8NAM11FT041.mail.protection.outlook.com (2a01:111:e400:fc4b::274) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3676.25 via Frontend Transport; Wed, 23 Dec 2020 18:19:04 +0000 Received: from DM6PR07MB6618.namprd07.prod.outlook.com ([fe80::b4c4:dc11:5337:821d]) by DM6PR07MB6618.namprd07.prod.outlook.com ([fe80::b4c4:dc11:5337:821d%4]) with mapi id 15.20.3676.033; Wed, 23 Dec 2020 18:19:04 +0000 To: Ben Ramsey , Mike Schinkel CC: "internals@lists.php.net" Thread-Topic: [PHP-DEV] [RFC] Add is_list(mixed $value): bool to check for list-like arrays Thread-Index: AQHW2Vb3g9SKyC+HcUGt0yLwvhDINg== Date: Wed, 23 Dec 2020 18:19:04 +0000 Message-ID: Accept-Language: en-CA, en-US Content-Language: en-CA X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:8012B0DA9FDA8919DB1902B14C4B3C4D38EECD35E9B625FCBE4454F087DE6533;UpperCasedChecksum:327E61693215C1778A813F23915B3548B48F65E58FFAE9E6C4B2CCDC8F2E02F6;SizeAsReceived:6941;Count:42 x-tmn: [rf4hveDATM6BsJLA2iifYJjPpfuK/zaKZdLRPNByKDss8VzgvvK4oResED6BwBFU] x-ms-publictraffictype: Email x-incomingheadercount: 42 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 4016ebe9-aed0-4a4c-cd74-08d8a76f3ab4 x-ms-traffictypediagnostic: BN8NAM11HT013: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 0xqHI9X7lo5QcgmtHTdhRVQfIJPMb+KHdGA1brnCdpyEbG5lG0ZrwjtQ7IIaqiG+L/M1AGUy5X1kuDwn/DsXYEyyU6Mm0Ps/wWjDTuJL4SypTYGPChxpkWPHV7y6lflVvzd5Qlz3z1w7ati7Bskr8TO20Z1oK5gazTyd+ckQaexyhZlMQh5DM9Oct+7D0U6+W0lQjCwOJkcA+WQPVcFZk+f7W0fCgo+T8HcfJR6is86o5lwbCwST/aEoCHA8D+Up x-ms-exchange-antispam-messagedata: RKz5uQct/VvnWcACanzIlroo1nzc5o+kCJrLseKi6DNqvFbgb26651JYbIUM8O04R2oIgUBks0BtBKHWTnXRfLTHwDSdPpGA3mseji+SWUyL0HrzbhgrXI25fg0T99mVXfwSiN6ETOrOrwNwG6TQYcE7Zxir4axiKBxwSzteDW4yhd+o2CuKTSqyHcO7rWZq2GgGJdChOBabSGuIuVwCLw== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT041.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 4016ebe9-aed0-4a4c-cd74-08d8a76f3ab4 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Dec 2020 18:19:04.0751 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8NAM11HT013 Subject: Re: [PHP-DEV] [RFC] Add is_list(mixed $value): bool to check for list-like arrays From: tysonandre775@hotmail.com (tyson andre) Hi Ben,=0A= =0A= > I don=92t think changing the name changes my concern, but as Tyson=0A= > pointed out:=0A= > =0A= > > These idiosyncrasies of php and unintuitive behaviors existed prior=0A= > > to this RFC.=0A= > =0A= > I=92m generally +1 on this RFC, but as I think about it, maybe there is a= =0A= > problem with the name. If we choose to introduce a pure list construct=0A= > at some point, then `is_list()` may cause confusion (or maybe it won=92t,= =0A= > if it can be made to return `true` for a zero-indexed, standard PHP=0A= > array *and* a `list`, whatever that might look like in the language).=0A= =0A= For the possibility of `list` being added to the language:=0A= The syntax conflict with `list($a) =3D ...` may cause issues with supportin= g it in the parser,=0A= and confuse people learning the language,=0A= but I can still see it as possible since the parser conflict also means tha= t it wouldn't conflict with existing names (if that were fixed).=0A= The fact that my RFC is also using "list" to refer to sequential arrays sta= rting with 0 may encourage that name over vec=0A= in the future, in combination with SplDoublyLinkedList already existing.=0A= =0A= - I guess `list[$a, $b]` may be usable as shorthand for list creation but t= hat's out of the scope of this rfc=0A= =0A= So the naming's definitely a potential concern. My earlier idea of `is_arra= y_list()` or `is_array_a_list()` may help avoid that ambiguity if that's a = concern.=0A= I'd still prefer short terms for common language concepts - zero_indexed is= n't a commonly used phrase=0A= =0A= Cheers,=0A= Tyson=0A= =0A= =0A= =0A= =0A= =0A=