Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123107 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 BD5A01AD8EA for ; Thu, 11 Apr 2024 01:06:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1712797608; bh=e2XHnfL1zZAoiBbhWhkrMWaefww0d5ZS1qhVQGMoDHc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=GNCtOOIv5+yibOZ+ReeJKo5lDbX6xP3yFM1ZMt6p/FQ71cOtqUSDlR5fJc8tJB+fW ljS8Uq/WCicryhpmIbTHNluUl/tyzFOISFYkmpiD63hzjMJOnhgi+fzSsHkXZGjvou j5YAi9DtiTOIjjlHSnFcAEQOA16E8VPOe9RXf2IJZZ5uPR/9PUBfzDHsEy74ikB1P0 Xmme4VN6L6b9B2VcxtoFTFMJSqDyQWyCdD0c+yQXQtnZPr9bDMwGyyQkRgiiTMGAlb Solxrg7qKRrRxgd9XUQnm5p0wLQuGOKEs1F37LyMIcsqJMDprckWMSIvMrI9ZgyjFt kJndpEgcf5K/g== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A0A491801D9 for ; Thu, 11 Apr 2024 01:06:46 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) (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 ; Thu, 11 Apr 2024 01:06:44 +0000 (UTC) Received: by mail-io1-f47.google.com with SMTP id ca18e2360f4ac-7c8dd755793so196122239f.0 for ; Wed, 10 Apr 2024 18:06:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datadoghq.com; s=google; t=1712797571; x=1713402371; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=w4DU8Oek8mEmPVY4IEeprw7BKDUCrc4XApO4DYwym30=; b=T/4Qldopbou7zoSDWdst+cMX7Aoi+hD8YPaBdWuXrmHEMkPSTzGflF433bS07vxTi7 sFPtXUyJ/yiPQ/260FQ89QinFjl2/WodgQcvsDwhuMMzZLMb32v+Cn8C3VQP9ACGWe+G sfWMCRztOXYJ6WmaMqWV1khhyDOe/zYscRDi0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712797571; x=1713402371; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w4DU8Oek8mEmPVY4IEeprw7BKDUCrc4XApO4DYwym30=; b=JEgkIs3mK/vOPUX5u648zU/6aMvY5Ra6Cf2rjoehzerhvaEKoD5LMLaf/0+UR6dZTf dHIfgyR1dIO5Aob1E4BQjamUAUALKHCufZw5GraKlbWtNoNOTOlRUdUJTip3HZUTE3nA 767OwZIhwZGZ3ZEmvwTxj9O6ynrO4KwlhA2JpjPMe8lo50Zoql9bcrMCE6CAug5826vR KGFVWHJBdpJHLMJwGKOuCbmxfCoDW8/Gi9IOzFz2L4Qtev4cGVKiwij7qv1H3mdrGxxo KiY3mmvG/VzrDoQSS3RpA9Ir9AdLs8Ve7QVfoFOZpnH0Ucg05FgeC8wBDtvyTax0Xed9 Aqwg== X-Forwarded-Encrypted: i=1; AJvYcCVWcwUMTjRZ0ZPbGJWeS2Ud62rdCqGXRKwRCxf8lkfkIfZdqvZD+fcX0rTeS7kAbt40z0KsJNEDshvCL5PVnz6wTbds3+EATg== X-Gm-Message-State: AOJu0YxO8VUku3Lsne1mTEBXLNwHJafKf2Rg6dlB+hAY4QJz8LcpeJBm SfnajKv8NpW0Lq+2jWEL/sgoCSspQCKDiSYHc8u3qbYVg0D74q/7txBxM+OKT9HHXyFJmv2KAPR 76CZ66S3hVyTK9LVjwCoRv5J/Ab4QUvq4oGhD7w== X-Google-Smtp-Source: AGHT+IFIggbHgC41au6S/KwQzfuN06H2BNjO9TSh+7A7WAx4m5g9w+BUev2vy37fqKWNHQacVW+pK5tLz1AD47Wt95s= X-Received: by 2002:a05:6602:4743:b0:7d5:f591:2cc2 with SMTP id dy3-20020a056602474300b007d5f5912cc2mr5519132iob.17.1712797570744; Wed, 10 Apr 2024 18:06:10 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: <24e4529d-0b75-44de-90ef-34de5dfb1c99@wcflabs.de> <278889be-82ab-4827-a9e7-801b5ba2d8f8@app.fastmail.com> <45b726f4-8085-43e2-b701-6b35bc249409@wcflabs.de> In-Reply-To: <45b726f4-8085-43e2-b701-6b35bc249409@wcflabs.de> Date: Wed, 10 Apr 2024 19:06:00 -0600 Message-ID: Subject: Re: [PHP-DEV] RFC [Discussion]: array_find To: =?UTF-8?Q?Joshua_R=C3=BCsweg?= Cc: Larry Garfield , PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: levi.morrison@datadoghq.com (Levi Morrison) > On 07.04.24 16:35, Larry Garfield wrote: > > 1. Should this work on arrays or iterables? This is a long standing li= mitation of PHP. The array operations don't work on iterables, even though= we've had iterables for 20 years.) > > In the longer term, it definitely makes sense to create a separate API > here that can handle not only arrays, but iterables in general. I have > heard this suggestion in various places (including in the mailing list) > and had also looked into it in the process of this RFC, but did not > pursue it further after the initial idea, as it would be important for > me that such an API is planned accordingly and has an appropriate > repertoire right from the start (functions such as map, filter, find, > push, pop, =E2=80=A6). In my opinion, a single function would be very out= of > place, especially if this API is then really soon tackled and then > possibly differs from the implementation of the RFC. I think it's fine to have an array-specific variant in this case, because arrays never have duplicate keys. Iterables can, and that may factor into design. Additionally, arrays are not consumed by iterating on them, but iterables may, and this could be a gotcha. I think it's fine to have an array-specific version (simpler, nicer).