Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114591 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 51165 invoked from network); 25 May 2021 14:25:26 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 May 2021 14:25:26 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D40351804F8 for ; Tue, 25 May 2021 07:36:43 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 25 May 2021 07:36:43 -0700 (PDT) Received: by mail-yb1-f179.google.com with SMTP id o18so5673419ybc.8 for ; Tue, 25 May 2021 07:36:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datadoghq.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=x+V6Sd6azhYThr2mj1zHSVRPhoLfvwyygFSWlaXK6lU=; b=BfveyjkoKHCDP5ybvXmVUD6Xtm8a6X7uSuyANXFL+K70nVHrqx5KbuiJDq6OFMElF3 40cpkmpYg98p5gdLY7UYghYhEJF0Uo5Hh53ju9HfiK6+IyqrwbQ+q9lHWPs2kqQiYZoA w+5PwAKBQxBdc4VmzfpWugcFRlo07aboNUvfQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=x+V6Sd6azhYThr2mj1zHSVRPhoLfvwyygFSWlaXK6lU=; b=bnFNEJMc7N3cCXsxBJQTMJOGFXkexd+SbsEL4DRhs8EU/Nu2HZ8kUdAYkRtkZJbYDH 5AE3HCrP92s9hFC/bDhU+vmGT7xd88SpUeDQyxZNS8wGYHbzkf/+/uiw5TphB2PcWJoJ PZo6YSsE80ABBaKuDSccFvQre7Mj2XPzZGlhT7J5pkGn+Ul0+Ny4pn3+gsMD2G5ZaXmg ow7HSnC+YSYFkoo5+tsUiRP4VIUDIbUkBDt453myurEFAwKawastiCB9/5uO5PSU8k4H P/SpQICueCVeS3/IIWDTCp9uk7x0IxNOhoMBrTP6q2AxyYlSco/JuB0NdxG19rVglG+2 Eu0g== X-Gm-Message-State: AOAM533rTxsslv7yQiWkQ7gsQd04BXtVGKW+k4C5CMZFjpBmQFofsiKQ 1ziqgGboJd03OOtt1yUG1u47lkYmCGxrH6AKkHn8iQ== X-Google-Smtp-Source: ABdhPJxZXj1N3VJW6e0oW32Jc1GmeDCYL2HTlyEiYfWoP69ItYYZvgGYZ1e6uHNQbxW5gYMamS6NjmoeMZCTYDVEaZg= X-Received: by 2002:a25:e803:: with SMTP id k3mr40191287ybd.268.1621953402725; Tue, 25 May 2021 07:36:42 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Reply-To: Levi Morrison Date: Tue, 25 May 2021 08:36:32 -0600 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Allow combining arg unpacking and named args From: internals@lists.php.net ("Levi Morrison via internals") On Tue, May 25, 2021 at 8:18 AM Nikita Popov wrote: > > Hi internals, > > Currently, argument unpacking (...$foo) cannot be combined with named > arguments (foo: $bar) at all. Both func(...$args, x: $y) and func(x: $y, > ...$args) are rejected by the compiler. > > https://github.com/php/php-src/pull/7009 relaxes this by allowing > func(...$args, x: $y). The named arguments are required to come last, > because this automatically enforces the invariant that named arguments must > be sorted after positional argument. > > Are there any concerns with relaxing this restriction? > > Regards, > Nikita How do named parameters interact with the variadic parameter? function f(...$params) { var_dump($params); } $args = [1, 2, 3]; f(...$args, params: [4, 5, 6]);