Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122962 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 A16DC1A009C for ; Fri, 5 Apr 2024 10:24:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1712312704; bh=enKPqmIOE3kT4v0y7+0mRXz7iEAPeTsIpW4pK65lKrk=; h=Date:Subject:To:References:From:In-Reply-To:From; b=HltUen7olCC1CFgOnysS9NNCD4fXBSwtT7lE+ipIafGSg5t5ffTQg+TZ1sGg94dTv 7LNJUpxvfftxid7v2c/XTxgB+DSHTVEV259GsiW84mLt99/3QLHOKyRRRkrOsqdBPe Q3UVWnFCM6jFomn+bpZBbuijYOd7WM8VQumVzrfqD6JQg2xCYaICmLg5o1tOrlMoh3 1OPupFCKh/PnzF3TyOsxMJDlt4MCS45pk3NhLLFJBZ674E0Yl8j2mJY0YTDJc37ey1 NgQ+cle0cO1M/M1ArPa3gJ/Djdd+VXJzzU41DKP/9Q7Q+nMS2d0cFdsa75m+Iid8jo XyNoMS2uqLPeg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B3617180832 for ; Fri, 5 Apr 2024 10:25:02 +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.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,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 chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (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 ; Fri, 5 Apr 2024 10:25:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1712312671; bh=Bs9Jq6VQvvPy13krfSstdIw+pc1MLwDSJCtSWrgzbuM=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type:from:to:cc:subject:message-id; b=gqiBss2lAaVAJhpteJFQqHvJ151nqei9bpUkOSTOcbzWmGx1k0A0+RylagY1zq0qk UxgLNkHWIACqBUfTe9d4xViFYgz7ST2d7/gdSNdLi3l5w1ANmVIY7FQpVW5wa3bsBB l/uqg8PWx/IxRiVs7ddIpy1Jkn0MhT4ye4nEbesWaLIRyKj35rii3Sqf1REWYOnBOn O/4qis+2bYaFxxSH18sqR3kGfDiFF85S3us4nRPnclKbA4tRFPE79h018s3oEDkMLv 7wCGpexGj6vjLiG9x7aa/wNX9SRfStan4xpIBzMI/P8vncnpbyctkorLsZn4Hdu9xf tk7U2FwBxqLHg== Message-ID: <2b7a4123-6d54-4416-b5d3-5ba28da82e51@bastelstu.be> Date: Fri, 5 Apr 2024 12:24:30 +0200 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Subject: Re: [PHP-DEV] RFC idea: using the void type to control maximum arity of user-defined functions To: Ilija Tovilo , PHP internals 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> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi On 4/4/24 23:27, Ilija Tovilo wrote: >> I think it would be reasonable to consider deprecating passing extra >> arguments to a non-variadic function. > > IIRC one of the bigger downsides of this change are closure calls that > may provide arguments that the callee does not care about. > > […] > > The user may currently choose to omit the $key parameter of the > closure, as it is never used. In the future, this would throw. We may > decide to create an exemption for such calls, but I'm not sure > replacing one inconsistency with another is a good choice. I must admit, I find the > This RFC considers that anonymous functions are not intended to have a formal signature and should skip the exceeding argument count check. bit of the previous RFC pretty reasonable to reduce the impact of the deprecation: I expect this type of callback to primarily be implemented as a single-use closure, which aren't really part of a package's API and thus relaxed checks are fine for those. I also don't primarily see deprecating passing of superfluous parameters as removing an inconsistency. The more important bit for me is the improved error checking, i.e. I'd prefer to resolve the inconsistency in favor of the stricter checks, instead of relaxing the checks for internal functions. The previous RFC showcases multiple examples where it found bugs that likely were introduced during refactoring. Best regards Tim Düsterhus