Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125828 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 6D2111A00BD for ; Mon, 21 Oct 2024 20:50:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1729543997; bh=ekvQwB5aN6YUAcf9KPWPSKm6SK3EaM5EJVU0ZIT+PF0=; h=Date:Subject:To:References:From:In-Reply-To:From; b=H8gwmbhBtz+SyCGTEP0lvIQdZTiTzkfSoYebUgIBYug/ylQSNFEXcDvsW301PzfeR oEIOuDlpEuTLMwYCn2do8g+DEQzIjBrITvzGfEtE2qycHrLtlll8zYuyppwzmAP8tn BqVdTUnTIz9IKipY3P74VJh0WRuv69EYQR9w2LZf6c6ySkG4MriIO2RtFsQ4aCM/F+ 2U7ds4vNWUQXv5HMEkq4NUZKHzsYxRJa0zJQw4dhPAd1oA64/nX1jXckso9ZBazGaa Ct9TM8BzX5hMsB+Fv1c/gfGYgZf9htXf7rYTzWmoBTM7HK2MWfxZrARXwOiuh+Wl9E rhx3hbhEQByZg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1A6FF180074 for ; Mon, 21 Oct 2024 20:53:16 +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.8 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DMARC_MISSING,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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, 21 Oct 2024 20:53:15 +0000 (UTC) Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4314c452180so39742025e9.0 for ; Mon, 21 Oct 2024 13:50:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=scriptfusion-com.20230601.gappssmtp.com; s=20230601; t=1729543850; x=1730148650; darn=lists.php.net; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=nZEb5L3fTVr82cQkT2rBO+yOHUGbnDbp259+F9YfwOo=; b=RSC4YY2yh/5FBY8nVZ9vGODsWZ1PahQxlI82U/2wlW8rJawN+P7OReU8YmHHZRANPa r1cUtN6U5S67HcztJnAc01PUJ9ww+IJebv8A9gstihk7YZfnOYJVQ3lA27oJnUFn0fMK N6ywgJ53MARUrHga6eYZFJ7OehAaWnQK93rZrKcZyp8bYgDDfoJrkHcaxY9Lq4mvgGbX y86ZWQvroSjYa3pDjTy3PK3Mk6CRQPZll/ohVr2JIqvXDDLgq46YjPwKaVD/w198cvC3 IXwU2/TVlyzXVhX7yyAioTRbvr/DlgNIY4xGMslPsK/W+uBKkctGB4BY6jMyTpoT73nC sExA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729543850; x=1730148650; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=nZEb5L3fTVr82cQkT2rBO+yOHUGbnDbp259+F9YfwOo=; b=HgMEEgT9uT/vZkuR8v6lAZxWeY5D0BRXW7reASAWOtnsYJdm/8vUSlDTlqAX6XuVk7 JT0IYcyOdUqBFsqItJdFKbVvJZE0F8mNNZsnnnvLsZdGCtttjhqrZox2WaEDpUq8JNpA IfRrLn+X0Er57gi8zENvQj+8xHAFpmalEc+Llpde9Bzfjzl4RUJOwOf/8C2OgmnpW6au 5w92+hWUG2KMdtG0QEGlYAOf+ZdwWrqCilA7ytqcuPxIgsSRDT9HuR0gWAl2RNBj/A6U PTpOR+0AcvatU6y3//BDqAoHU9RUQlayFMLRehzXbx3rQ/RDKi32q17iAk6M5QiSg9ex rwtQ== X-Gm-Message-State: AOJu0YymqZ2NFFrGnYznSL5q2R6e6Kg9v9U+J2lg463XlbVb0OzaZR4L 0Bb/ZXOqSVYYlSdCMXQEVWhM8hrul72lXtlKKOcvR3TP1ULo5TU/HGgTXFEc//Y31+6XQAv+fqZ b X-Google-Smtp-Source: AGHT+IFaRM/GEL+AXGpXvInhaWjFtesG1Zp1zWotRIUqd1ToQGWZ/9swdhAdm7DjvjtnKPu8INsekw== X-Received: by 2002:a5d:6a0a:0:b0:37d:2e74:2eea with SMTP id ffacd0b85a97d-37ef1262720mr596291f8f.5.1729543850170; Mon, 21 Oct 2024 13:50:50 -0700 (PDT) Received: from ?IPV6:2a01:4b00:bf09:5101:69c4:8731:9931:8a21? ([2a01:4b00:bf09:5101:69c4:8731:9931:8a21]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-37ee0ba7c27sm5097052f8f.115.2024.10.21.13.50.49 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Oct 2024 13:50:49 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------TiteiDGU9DNFB4Jn9Zr0DC4G" Message-ID: <4bf70932-d465-4359-9510-62d457d6e218@scriptfusion.com> Date: Mon, 21 Oct 2024 21:50:49 +0100 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [RFC] Change behaviour of array sort functions to return a copy of the sorted array To: internals@lists.php.net References: Content-Language: en-GB In-Reply-To: From: bilge@scriptfusion.com (Bilge) This is a multi-part message in MIME format. --------------TiteiDGU9DNFB4Jn9Zr0DC4G Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 21/10/2024 21:41, mickmackusa wrote: > On Tue, 22 Oct 2024, 02:30 Valentin Udaltsov, > wrote: > > > What if instead of this proposal we reimplement all of the array > functions in a different namespace and fix a lot of other problems and > inconsistencies? > > Array\map(iterable $iterable, callable $mapper): array > Array\sort(iterable $iterable, int $flags = SORT_REGULAR): array > ... > > -- > Valentin > > > Getting off-topic here The whole discussion thread is "off-topic" in the context of the RFC, but I don't consider that a problem; it's a useful discussion to have whether the RFC sparked it or not. Regarding the Array\map(iterable $iterable, ...) signature, if new functions are to accept iterables instead of arrays (as they absolutely should) then the `Array` namespace makes no sense. But at that point we're basically just putting https://github.com/nikic/iter in core (not that that's a bad thing). Cheers, Bilge --------------TiteiDGU9DNFB4Jn9Zr0DC4G Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit
On 21/10/2024 21:41, mickmackusa wrote:
On Tue, 22 Oct 2024, 02:30 Valentin Udaltsov, <udaltsov.valentin@gmail.com> wrote:

What if instead of this proposal we reimplement all of the array
functions in a different namespace and fix a lot of other problems and
inconsistencies?

Array\map(iterable $iterable, callable $mapper): array
Array\sort(iterable $iterable, int $flags = SORT_REGULAR): array
...

--
Valentin

Getting off-topic here
The whole discussion thread is "off-topic" in the context of the RFC, but I don't consider that a problem; it's a useful discussion to have whether the RFC sparked it or not.

Regarding the Array\map(iterable $iterable, ...) signature, if new functions are to accept iterables instead of arrays (as they absolutely should) then the `Array` namespace makes no sense. But at that point we're basically just putting https://github.com/nikic/iter in core (not that that's a bad thing).

Cheers,
Bilge

--------------TiteiDGU9DNFB4Jn9Zr0DC4G--