Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122956 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 DE8B41A009C for ; Fri, 5 Apr 2024 07:12:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1712301151; bh=pQ1tTDtmP0EPkFCjP5pt4KA92cS9rAZv+g1U+qaI6LE=; h=Date:Subject:To:References:From:In-Reply-To:From; b=cOHsAB4XHMX9T1Sm9wYEIeAQxJBpFF99WWwfklT3AY5qHreriVOfVtahV11yVDT0L xQHsBQGyAaGKIFY00oYrNVcq89C+k7nBUKs1TFvRWPptlIgBY96XA/Zi4NLFf3vq/O PAYSQkKz+4KMy1VtCTerkN07gJICHAhDDTmdyEn0VmFGPVCmJ7XtjV1CDNMef2b7rK KwLbp/Jq6L3cMzbKj67XNEX8Mq7tPOPAXI90tusSWvF8graPu+YQ+3JDJgZLV4k4Tk YrfGTGwbXdt/wGYrkf5XEWDBvXWIJylaTl7eA4cNPi9BJU3V12I+9oC3/W6Te1IK0K gcdttmTbJtb/A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6BF6B180047 for ; Fri, 5 Apr 2024 07:12:27 +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.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,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 smtp-190f.mail.infomaniak.ch (smtp-190f.mail.infomaniak.ch [185.125.25.15]) (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 ; Fri, 5 Apr 2024 07:12:26 +0000 (UTC) Received: from smtp-4-0000.mail.infomaniak.ch (smtp-4-0000.mail.infomaniak.ch [10.7.10.107]) by smtp-4-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4V9qRb5clLz5TK; Fri, 5 Apr 2024 09:11:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=processus.org; s=20231208; t=1712301115; bh=pQ1tTDtmP0EPkFCjP5pt4KA92cS9rAZv+g1U+qaI6LE=; h=Date:Subject:To:References:From:In-Reply-To:From; b=FZPzIJEEbXYVNrCjYkGZSO04cG6QxUpnjqCeR3FHgSmDYMrGpNZQIo5X+mhWJ8ODr J6GrO4U61WP3zEiO5MQEJ5loBIwt59ITTxfTM5V4DyNhRYm28pPyN69URNnrhd0mpp oISvoRCs9L9II8gLq5V740NDJmG63KCaecvxMPX7yU2WAz5fNhXKLQ16Unewapl7LB TwOlxv8QZTEjEZBVpAZ7SfHpILnrAgHJ7HJYd/nYOIGgJ2vwobOnjjpbFTlp1mVbEG rjalslLJtMsY/ws2okjedjb29XliRjZK5CvgrTfD02WAgykyYticLIgtr5IT8gMuEx iqcc8dshnUpQQ== Received: from unknown by smtp-4-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4V9qRb01R4z6p3; Fri, 5 Apr 2024 09:11:54 +0200 (CEST) Message-ID: <32ccbf49-dd3c-49c7-a33f-c85566acc72d@processus.org> Date: Fri, 5 Apr 2024 09:11:54 +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 idea: using the void type to control maximum arity of user-defined functions To: Mark Trapp , internals@lists.php.net References: <6299b649-c19b-4172-9632-2ef0a55d256d@uzy.me> <7B32AF65-CA40-40F5-BA59-CB5180EC4D7F@gmail.com> <8f71d807-78e6-49f6-acc7-b1fc09d815ba@uzy.me> <989e3e13-48ee-4970-8485-f79bb70ad37c@bastelstu.be> <3B22ABD9-7F0F-4772-B47A-FD0A7068F63D@itafroma.com> Content-Language: fr-FR, en-US In-Reply-To: <3B22ABD9-7F0F-4772-B47A-FD0A7068F63D@itafroma.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Infomaniak-Routing: alpha From: pierre-php@processus.org (Pierre) Le 04/04/2024 à 23:38, Mark Trapp a écrit : > On Thu, Apr 4, 2024 at 2:16 PM Bilge wrote: >> On 04/04/2024 16:57, Tim Düsterhus wrote: >>> I think it would be reasonable to consider deprecating passing extra >>> arguments to a non-variadic function. >> This seems like the only reasonable thing to do, to me. If this were the >> case, there should be no need for any new syntax, since we could simply >> deny passing extra arguments in the next major, no? >> >> Bilge > I'd caution about being too hasty to deprecate and remove support for > this feature without understanding the underlying reasons why it has > been used historically, and without providing a better (not just > different) alternative for those use cases, lest an impossible upgrade > path is created. > > While the variadic operator should be a 1:1 replacement for using > func_get_args(), is it enough of a benefit to force potentially tens > of thousands of codebases to change when they both accomplish the same > thing? What bad thing happens if PHP continues to support both > methods? > > There is already enough friction to upgrade between major versions. > Introducing an optional attribute or syntax allows codebases that care > about signature strictness get that safety, while avoiding a > potentially costly and onerous upgrade for the community. > > - Mark I agree with both, ie. I think it's reasonable to deprecate extra variadic arguments, but also do it with caution: some old code, some templating systems for example may use implicit variadic arguments to pass values to templates. There are tons of use case like this in old yet still running code. But I would love it to be deprecated, raise warnings, and give some time for people to fix (adding an explicit `mixed ... $values` is enough to fix broken code). Cheers, -- Pierre