Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123023 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 0DF711A009C for ; Sun, 7 Apr 2024 19:10:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1712517056; bh=Besqpw39n7AmeL6hFvV5Z8z/FBbtKKLSJwP4U/fWWv4=; h=From:Date:Subject:References:To:In-Reply-To:From; b=BxAMSXrGDfmhkc7jmQPufoUAcVQ/3DXMqfmigjLgE4CfrYQmBwz4ZTJQqaZlKIInS 1uOZX8Aqm8vC5wD7F0ubtfYP0DYqQ6w0RanjBRCi/DcQfhmw5KXU8a8Y/qbNO9QayP mEpRMqrm+BeYXUzrMapbXSoVCtJnbZQy4g/HlJjj/IvzWuMup8aNUALtF4Nc9A5wJ4 UyX20F5C9fzGYMaVE8UVs/ybmWA2puMqCWNQcy0MLOe/wh0Tunb221EZeM37HzS2EU gdy1jDdMrYWUnG7DCojvH6M6SORVosH23rq7HbO3i5cqinjJ/iYaQRLKAeE0odQIPg rGzPee3sCnm7Q== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2CF38180538 for ; Sun, 7 Apr 2024 19:10:54 +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-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (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 ; Sun, 7 Apr 2024 19:10:53 +0000 (UTC) Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4155819f710so29045395e9.2 for ; Sun, 07 Apr 2024 12:10:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wcflabs.de; s=google; t=1712517021; x=1713121821; darn=lists.php.net; h=content-transfer-encoding:in-reply-to:to:references :content-language:subject:user-agent:mime-version:date:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=t0GDzO2wmYf4boRzfy0NxLy6TcZAB/0PpSRoorfTOv0=; b=Chq3IEENUGefTqZw9ohKtG/1EI6rpogzu5VDuwSHalsXDOwOzZSktBTbp+9QbqLF+I 6+1Mhn3y8pxRSHNcaKjwGWe3G88gwR5yvXdUwqQmWIo6ATXOOONki47kW+VT811GWZd/ W3LLsBjlexlH5kE476qxwyCx8PzeFejp9Ee1HTL4o983V3xMeO2tXDu4sed9MWml6sl5 QBqQPj7yUHPY81qyy1Ppk0kbw1lacS0EPi7BNRED6Qtl6l6u55v9/Xr70QmATDen8oxs RtGdi+3RRgA76/EpI3zaLr0Vd+eoaAU8bxuAE//SdJ3Ruv/FbHoxwyqfWbavOAaClzXV 2Vsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712517021; x=1713121821; h=content-transfer-encoding:in-reply-to:to:references :content-language:subject:user-agent:mime-version:date:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=t0GDzO2wmYf4boRzfy0NxLy6TcZAB/0PpSRoorfTOv0=; b=KxjJtuFlr1ePDc7bqZjMxfmmKExZ9o1WFoBdJ6+1xLI4Kzrj7zxhv0WjjT0zRhZpN4 tNKEswiaVRHMbQQPJmtnmnNF6ZJ2MjVPNY3C5m4UpLasuO68mE3fgd6eAPngKzwWLYfA rGvV4DK8X8InQ1WPzHePKHszXiRj9L9lAqUw0PNtSOI2i5Ks2KA3t9DrY4CiGi244AxN Swn+Yqexf2WBAkCerVxd/4U3dsud21Jcx10fkvvoyKyrq9Fsw4FiQ06gQkLXXmsfTByr DdXWoV6o1R2uND6q7bfzZbgxmc7cCltYgI/xUSxZ6iOwQZ5VFjz1XZWJCybr1B0Jl0Kb jlWw== X-Forwarded-Encrypted: i=1; AJvYcCXeaFwPYwdpKUZC9kMU8l8MNanHYEk1xiAqicTFmPpcQcmM6c9Kl5yBWnT5jHVnRNZOB0ZvhMOydKnGv303AjQQFsIrwzuWxw== X-Gm-Message-State: AOJu0YzdiImSwvYNErECPuzSa4N47DkkOG5PPq1DcWPeF1TNQtN9gmfI bNojl8ATBq6pjdB/MmXduLWE0SnQJYYTVV0Mg5XT0gDgVQS6ewjcdOZh/Ky5wj3QVBppR8m4fOt V X-Google-Smtp-Source: AGHT+IHIsGb3Iuv6ktsx8miwZj/zhV/m0Ocu9SHJRFZED5QWXIYYjWP4yv7UZQIXbDyGTbFPz5FeOw== X-Received: by 2002:a05:600c:a019:b0:414:726:87d9 with SMTP id jg25-20020a05600ca01900b00414072687d9mr6995060wmb.12.1712517021002; Sun, 07 Apr 2024 12:10:21 -0700 (PDT) Received: from ?IPV6:2a01:598:a029:144e:d19d:a0b0:5b39:bb22? ([2a01:598:a029:144e:d19d:a0b0:5b39:bb22]) by smtp.gmail.com with ESMTPSA id fs20-20020a05600c3f9400b0041628f694dfsm10718659wmb.23.2024.04.07.12.10.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Apr 2024 12:10:20 -0700 (PDT) X-Google-Original-From: =?UTF-8?Q?Joshua_R=C3=BCsweg?= Message-ID: <45b726f4-8085-43e2-b701-6b35bc249409@wcflabs.de> Date: Sun, 7 Apr 2024 21:10:19 +0200 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] RFC [Discussion]: array_find Content-Language: de-DE References: <24e4529d-0b75-44de-90ef-34de5dfb1c99@wcflabs.de> <278889be-82ab-4827-a9e7-801b5ba2d8f8@app.fastmail.com> To: Larry Garfield , PHP internals In-Reply-To: <278889be-82ab-4827-a9e7-801b5ba2d8f8@app.fastmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: josh@wcflabs.de ("=?UTF-8?Q?Joshua_R=C3=BCsweg?=") Hi On 07.04.24 16:35, Larry Garfield wrote: > 1. Should this work on arrays or iterables? This is a long standing limitation 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, …). 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. > 2. Key handling. It's good that you have looked into this, because I was going to mention it. :-) However, I don't think a boolean is the right answer, since the question is binary, not true/false. (Those are not the same thing.) I think a small return-mode Enum would make more sense here. I like the idea, thank you! However, I am unsure whether an additional enum for the function would not be too much overhead. Cheers Joshua Rüsweg