Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125314 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 664361A00BD for ; Tue, 27 Aug 2024 11:56:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1724759919; bh=OBB08Gl67BNaNbt0S+TzoVi+I3lDru4wUiaBisyUMDg=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=Gal78bkHtJNoAMeRmlmwQOoJ9qIrEADfkfylACKilJ0gpjrx6S5kEJ+gRFrXNFmJM GNRfGmCOiE0aXWyW5BDy+I8qkDb8h0538CmiFt2ATlEVIBZQvjxxJwF4LVoZO+dyQk 7qtFnA9LBYXvHE40kHfmK9aJjk1tgNxEjKbBcMILrSf1wnOvXQ/Ek2p3rgyq8GUK4E op3Nl4MZKOtdtRv+DM391huqbDGYTYsrJBEoyN6v+NcDFa6e1kxxbD3tS7qImFd+w5 GRxJkghLcHP2xbpl0XbcvXm6pIPu7EDdWOOQ0FP/UGGdpdQ52n62Lfu8JQBbf2PpTz UBjAITawML9dQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9D8E7180209 for ; Tue, 27 Aug 2024 11:58:37 +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=3.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_PASS, SPF_SOFTFAIL autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from xdebug.org (xdebug.org [82.113.146.227]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 27 Aug 2024 11:58:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1724759800; bh=OBB08Gl67BNaNbt0S+TzoVi+I3lDru4wUiaBisyUMDg=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=hyfUb/m9GfQZ47ZtlmuJl/cJwv/RvbfN4T/PSehZUBbujOyQPGwObbCBXaBWzZpwI H3WtV1u9wjtNkfwqk9LsfbkUYPo9Xx56tlxIEWzpvwJo087leX+WTOa5Sr+Xhsz2c8 nmUIQfo2rEwiWDWSq4Lqr3FWe5woIia/+0zWobJgiXds6STsNQx6q5YMVlh8UCo6T7 14iUE7/malpNEI290GUabZr8Hm4YIUgcCyqX4k63FDnlOO3LXlg/KVZl6JGnPlJz2j zZMuy4TZgGXCNWgKRfVpDCTWoHnfq+oAw4NFCF9ah7Fw3x0vOXgUZKtlG/Moh/oA6L xZ4ZgYfw10zDw== Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id 7225310C033; Tue, 27 Aug 2024 12:56:40 +0100 (BST) Date: Tue, 27 Aug 2024 12:56:40 +0100 (BST) To: Bilge cc: "internals@lists.php.net" Subject: Re: [PHP-DEV] [RFC] Default expression In-Reply-To: <0c8ed5d6-5507-4c41-8d7f-05d14ba8aa4c@scriptfusion.com> Message-ID: References: <0c8ed5d6-5507-4c41-8d7f-05d14ba8aa4c@scriptfusion.com> Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII From: derick@php.net (Derick Rethans) On Sat, 24 Aug 2024, Bilge wrote: > Hi gang, > > New RFC just dropped: https://wiki.php.net/rfc/default_expression. I think > some of you might enjoy this one. Hit me with any feedback. I liked this up to the point where I saw: $f = fn ($v = 1, $default = 2) => $v + $default; var_dump($f(default: default + 1)); // int(4) Using 'default' as a place holder for (not) passing an argument seems useful. I am however much uncertain about using composition with the keyword in expressions. I also think that implementation would probably be significantly less complex as it was only used for placeholders. It's likely something that can be handled in the parser. Having an opcode for it, that does internal reflection, is what I'm unsure about. cheers, Derick