Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122940 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 C75C41A009C for ; Thu, 4 Apr 2024 16:20:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1712247634; bh=fkuKiDXob4itlTJ+lvshebQctgpLRNfI6tNXXK36NEk=; h=In-Reply-To:References:Date:From:To:Subject:From; b=HvXtv4Jwhe3Do09I1/i2n2b/0AJPf+StfBT0F/PjkONJ9zyyTdEnDGZJ8PZ0z2MNw UJE1idn2uLjRie0C/Kho9h6NfEUA84gMfYWYkb6h8QMAyPUftqdTfzUzHtfBP+AZDT j1ki4TcjOHjd2kzYIdgzjm5tS0EIP2LScqq7lWY4rjNiuq2lZlmJAcyuYnByuh61h5 DlMYiH+kpe1LBhaIoFXtVtAGIW07KRtsfY2/JnarO5IMd7eHFKwYdNdC4at2rRRo6T 66h5JK6FVgfLS984dXuVj2EwSUtATVV9k1RtIcewMnyu+kCYBIgE08DvgdHgqc6SKM HiwqS+nHjJKAw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3BB0C1805FD for ; Thu, 4 Apr 2024 16:20:32 +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, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from wnew4-smtp.messagingengine.com (wnew4-smtp.messagingengine.com [64.147.123.18]) (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, 4 Apr 2024 16:20:31 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.west.internal (Postfix) with ESMTP id 130E62B001EF for ; Thu, 4 Apr 2024 12:20:00 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute1.internal (MEProxy); Thu, 04 Apr 2024 12:20:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm2; t=1712247600; x=1712254800; bh=KpKNUvmDNrtI8yhuYyF6L nZxg0bKwwyuAWzRGSg1GGw=; b=ZLiKZ4r+5F8+ISOcUCFzcJ6E3003ggvh4WTCU 8LPrMQLlfa56wqSYH6mNQ6V5dvLpF6V61BlFgdQjjFa7XklmigK0g0dTH2r5ypgY H4ryjab2K/SkWUUPiTntH/Pb+t+1t6NOMBc9m9nyzuFGEAlicyOt2I38jcLyoTy9 rkIZmYAoboz3fvendhXjJBE6ExiVvlBXN/djr9imNSwebvd2ovjS1PoGBZ7sbOBG MfvKOATjHk9PWpOVoMcLJc8y1+c/4sqw2kF2R1PeHDQ+fyVQWeefztqq4c81uvxv oCjGOh1X0AY9mNujDyMvc18Rs6RlVSu+4awWpMtWj5gUwI65g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1712247600; x= 1712254800; bh=KpKNUvmDNrtI8yhuYyF6LnZxg0bKwwyuAWzRGSg1GGw=; b=F fl45yR4vd6xPW7gnxec+repyaV3baNPVdfpUPArikaOImYSJzfiMb1MsFejQr4LU TABw5H0M+ycs2UHdAsMb23BSC+YXD21is8Ccj3I6jfH84O6o9Lp2ANtVabfdHKhG yJtEFXvKs/IPagjK+TYKgROaSm0dcTE/euGBtZK13chc9bFvjpL4SlQTJaY24x7V kfKV6224H/4rTIYeBpCIi1uayxhP5tnp4fAeeTEK5AVVPDIVlP8b65JYcZh/zvIZ Hhp97+we3PdQL7/FC42U2fahdJkDdzOeDYaZH40hgAfZRSx51UhAsDBTNe2fVXr7 hA8CfK/JM3MYgXtMR1oWw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudefkedguddttdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtgfesthhqredtreerjeenucfhrhhomhepfdfn rghrrhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrd gtohhmqeenucggtffrrghtthgvrhhnpeffffffjeffudfggeevvdeitdetvdfgjefffeff jeelfeejteevheeghffhvdfgleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 4427E1700099; Thu, 4 Apr 2024 12:20:00 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-333-gbfea15422e-fm-20240327.001-gbfea1542 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Message-ID: In-Reply-To: <5969054f-1959-46a6-be5f-4de4550f2025@bastelstu.be> References: <6299b649-c19b-4172-9632-2ef0a55d256d@uzy.me> <67221462-6c9f-48d7-8c59-e7262a744ff5@uzy.me> <5969054f-1959-46a6-be5f-4de4550f2025@bastelstu.be> Date: Thu, 04 Apr 2024 16:19:40 +0000 To: "php internals" Subject: Re: [PHP-DEV] RFC idea: using the void type to control maximum arity of user-defined functions Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Thu, Apr 4, 2024, at 3:49 PM, Tim D=C3=BCsterhus wrote: > Hi > > On 4/4/24 17:40, Vinicius Dias wrote: >>> I like this concept, but instead of introducing a new syntax, have y= ou >>> considered leveraging attributes in the same way that PHP 8.3 >>> introduced #[Override]? >>> >>> #[Nonvariadic] >>> function foo () {} >>> foo(42); // warning: foo() expects exactly 0 arguments, 1 given >>> >>> I think the intent would be clearer and it would avoid introducing a= new syntax. >>> >>=20 >> I agree that using an attribute would be better for this case. > > I disagree with an attribute being the right choice here. In contrast = to=20 > #[\Override], this proposal changes the behavior for the *caller* of t= he=20 > function and likely also requires adjustments in child classes when=20 > newly introduced in a parent class or interface. > > Thus it is part of the function's API and thus should be part of the=20 > regular signature and not the attribute-based metadata. > > Best regards > Tim D=C3=BCsterhus I would think following the pattern of dynamic properties would make the= most sense. Require an opt-in via attribute, with deprecation period. = And possibly just remove the functionality at some point in the future. The core issue here IMO isn't the behavior itself, but the inconsistency= . C-implemented functions reject extra args. PHP-implemented functions= ignore them (modulo variadics). This is... a total mess that has bitte= n me more than I want to admit. Normalizing it one way or the other wou= ld be a win. --Larry Garfield