Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122936 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 DF3411A009C for ; Thu, 4 Apr 2024 15:41:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1712245304; bh=uMBWuupFpPrZsnqZDJP/krwniJTz5qnXOgAX7nUS4/0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=KsosQO7ufxaB+c65zv4gVw3BpwP8f9HM5ihfJu0cdrH6BsCgdOEp7E7gnUj3tknQN BeV/xUj3yOAHYRO7rmhqqDukWm2FNzl7WmYvhmBUrbR1TJboocNEj54vT4aQRBSEFm xSC54y+0XzkXFgtaSggtiPWq4U+Ox2k1YWO3YGLRrhO56R195cCj2Jw5oq984QiTd0 rEWWcdRR5VQRZjjuwdkdhRriw+WZv76xL/fFZLI+YvuGcLrBM5dt535MqRQzAwLE+u mTJcVKetke12JW5FV2y11SB+2wki28gyJYcoARcm6SYMlbk6fa2ba6MnJ+w/C4Np7X h24RoR3vArqRg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 16A6E180388 for ; Thu, 4 Apr 2024 15:41:44 +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,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,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-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) (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 15:41:40 +0000 (UTC) Received: by mail-oi1-f170.google.com with SMTP id 5614622812f47-3c4e99e7f78so182130b6e.2 for ; Thu, 04 Apr 2024 08:41:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712245271; x=1712850071; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=uMBWuupFpPrZsnqZDJP/krwniJTz5qnXOgAX7nUS4/0=; b=U7usYREqL6GhE63RtNfDJVO1oNnG78i5UXVepFusEbtVsv9ilC6xPTKU2Doa2zxVQ1 HFA225g+pR46I06N3xc/CXzs4+UG3uWWKf5viq3fgG1EM0u4XpzAyavyKHfmKhLxUUJo +KH/7GFJiWUWxeHmDL+p6EqjeWS36f46lYoGGVjDR7c41Bzrf4IfWQDz8QppeeyPDGmI 7uNG845vuQcgmGMFL1xlVSYRk5mM8aT6jaGENE+LZkpo72YmxGi2KmvFd9GZ5J5a2h4C FUwggwO0c6luKMPiQuJa8fb9HyZHtOrD8lugQC7h5PSLEqmURdQUWWdgHxpYD4BbpNT1 0pfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712245271; x=1712850071; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uMBWuupFpPrZsnqZDJP/krwniJTz5qnXOgAX7nUS4/0=; b=f5xnz+ge+loPcPujSTv1r0j7LW0s55B0vb2QCwQSBqKKX8EFv3ylyLq712vcrNzVff oYWb8aO3shrr2b1iAsOP9Xj7ZzRHXpEfCqGJk6XuXglooKAl+xTpFfBgkV2NW0JCWirb uD6WO3LY3lyxpf0JFeouHyajSESSFfj0shP8H8RglF+Lc0Labkl+K4e/gxUFSNaR/eOW Crh4hLJriwsfZiTA1mYfzy9+FyynRT68gsOxEwE1RmtDuwWUKURS7D+QygqxFHkew6oW w6623tQlUVvtJEV2SIJBA4X6DX1/L7dkuEtWBNEDkI9iBUsqyg6FrNZ+6GjSJwEltfXD qsqQ== X-Forwarded-Encrypted: i=1; AJvYcCW5uJHu6xxaM7gJGvTiSnS6ADaMeMVMZmqWAP8fUKNUP+jivNkQWrJzT4Zl9/GCzprIwlUZMC66eTf0Bjg2Fg2VWloRo+iOng== X-Gm-Message-State: AOJu0YyUO7CPb87H1IjLPPKSqMXZRj6M7dsYgqNP0qukRxBa81kGZdeX r4dQAobVXDo5twdMxOG3uzQ7UxGx/eyFrcWTxolDVjfvGbWJo85tlKND8lgq0poIKvzO47cW+Zy BLHn1ws1XnjrFIpgOs5vjEeSeEZMJ7BEW X-Google-Smtp-Source: AGHT+IEzpNf95aIcPFjhyhE2VZ2Wd5mKoR4C3RtuAeaig8sxRgGziBv9PQuevvhDYqwxoMivpDnpjAydKiRjI5BdCTc= X-Received: by 2002:a05:6808:23d0:b0:3c3:d2e8:7e5e with SMTP id bq16-20020a05680823d000b003c3d2e87e5emr3127731oib.40.1712245270576; Thu, 04 Apr 2024 08:41:10 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: <6299b649-c19b-4172-9632-2ef0a55d256d@uzy.me> <67221462-6c9f-48d7-8c59-e7262a744ff5@uzy.me> In-Reply-To: <67221462-6c9f-48d7-8c59-e7262a744ff5@uzy.me> Date: Thu, 4 Apr 2024 12:40:59 -0300 Message-ID: Subject: Re: [PHP-DEV] RFC idea: using the void type to control maximum arity of user-defined functions To: Pablo Rauzy Cc: Mark Trapp , internals@lists.php.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: carlosv775@gmail.com (Vinicius Dias) > I like this concept, but instead of introducing a new syntax, have you > 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. > I agree that using an attribute would be better for this case. > I would personally prefer the void syntax, but that's really because attr= ibutes look odd to me due to lack of habits (and also because it avoids an = additional line of code=E2=80=A6 which is probably not a solid enough reaso= n when it comes to language design decisions). As a reader of the code, having the attribute is much more clear to me than having something that looks like an argument. Also, with attributes, the code is backwards-compatible, i.e., I can add the attribute to my code without any errors or warnings even if I don't use the latest version of PHP, and even in those cases, IDEs could still help me.