Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125268 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 931F61A00BD for ; Mon, 26 Aug 2024 11:55:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1724673464; bh=IO+6PWv6tMpFXmcOh6gVF1wEUj2Bp2zHKLfLVB9R5qw=; h=Date:Subject:To:References:From:In-Reply-To:From; b=TVUMbz1oCI+cXIp/29aPwJQ+282RS1CfsWnr5QBMema1yceQpjW860q1JEmnXCXvt oV2PPahLMEiPecf5ari2abvrDF2kigHu1y1QZ61jlfuki1kKnhukFjmALWAXkMT9bX l7hp4b+VQfgvTlQOtM8KU/9dojqeLCuZSCcehBFQU8vnTfrS/FxWcpdWilmLF9D0Va NbDo7uR1vo16XJVGFgmeLNLC+VBzqmDjVpYXaxSO16+1zzELBjOPEGhcOY1YGtgXur MxvkqDsw9GFSZtxAjiO1W6VsZCIXvHfWT4wu2disNkAUNwHgI2wa5HxE6ngVUX99uM JNO4C0Lv5Xeew== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 19888180054 for ; Mon, 26 Aug 2024 11:57: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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (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 ; Mon, 26 Aug 2024 11:57:43 +0000 (UTC) Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-3718b5e9c4fso2163936f8f.0 for ; Mon, 26 Aug 2024 04:55:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seld.be; s=google; t=1724673350; x=1725278150; darn=lists.php.net; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=8fxqolzTrqMR7Izo8tDC42yQz8dorUJegGr7761XK+8=; b=YK7azxqBP/iKkukaMunjJjWZkDD1qBcE40bshU/ip5/tqqfDIf710u7EK+muwB72aa HpXCjlvDXNh8hIH/q8kt9dcRuJsgpymy9VNdLk+GwG4HjLAOKfZYRi6BZUTEYmFISavM e2Y+BSBDLHIMQZ4a2hWHCtY9YbHR5aSuhQ0GogyKzB1+NDO2QKKkFU0JaY2GNhRD7bgd rdnsVyerSL+PhUzRVSyHrTR0bTEH3225wkIiWI3gOT9jKO7LW5/HYdqhi3n81VgWLsk7 WBe8R9OtO35j4ix8Ya7U0Y7Pgld2hqmWKFLbDr3PpBKcFUR3cm6IXYftk34CpWVuuI+T vSzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724673350; x=1725278150; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8fxqolzTrqMR7Izo8tDC42yQz8dorUJegGr7761XK+8=; b=Qi8BeWFSgrTguZzGYUqSi5Ky6eMNM8ZBVz99SpwxpAYE73jjfM6jkFJ5hHuoba3Ps9 KJnf+WrRBjU5PrRX4flZE7s97C/0yxfQGmugZEWmv0f5cakNlZcvgk2Gk0F6oa4iMY0a 0bQvAdHY28DfJnUKBR/lm37JDTht/dYXEsDEG5izNYAxe8HHYa9B2PEHeXLGZilqlFa1 CaN7XjhxWsjPR/rRV0EOXizomc+Ezs5TnS1dBDKv6mWXOWxf0acB60UadpRK4bBV+qkb ++TCqCQ6ZLu0pZofiJX/5eA1X7n4e34X6w9RLUa26nkMuWd3UHzl7DAIzUp953fOpb9w zWDA== X-Forwarded-Encrypted: i=1; AJvYcCWApvdjGnY9Z+unZd+NAKqUBB9Z2vssABP1FcKGDlhRbNNwpMFulxD+4YF/zVPS3ZmZX3My6FHI6A8=@lists.php.net X-Gm-Message-State: AOJu0YxEiaPPkz/ZVHNSt5enUpou/7hrRFnAW0ohgxSkOQZJkbLb0l6u oF2uM5AHYZbTLc6YEBDuFmrI5nk5t3VZIcWXAKrBcyUJi8CqPfJslLK/cR+hiZnAgLUGstgHyh/ dk/Q= X-Google-Smtp-Source: AGHT+IEuF7JibHxL9s6MWRlM7/TpXQ7aUsFpGTJfo1n4cYGGEuVD8XE1FFP5iUi/I0xDmnEt74d0Og== X-Received: by 2002:a05:6000:2ad:b0:367:326b:f257 with SMTP id ffacd0b85a97d-373118b8b96mr9474145f8f.33.1724673349414; Mon, 26 Aug 2024 04:55:49 -0700 (PDT) Received: from ?IPV6:2a02:168:4b6e:0:54fe:a13:68e2:a88d? ([2a02:168:4b6e:0:54fe:a13:68e2:a88d]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3730821adc2sm10619011f8f.91.2024.08.26.04.55.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 26 Aug 2024 04:55:48 -0700 (PDT) Message-ID: <4086414f-f8cb-4209-a127-0de19f065a47@seld.be> Date: Mon, 26 Aug 2024 13:55:52 +0200 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [RFC] Default expression To: Bilge , "internals@lists.php.net" References: <0c8ed5d6-5507-4c41-8d7f-05d14ba8aa4c@scriptfusion.com> Content-Language: fr In-Reply-To: <0c8ed5d6-5507-4c41-8d7f-05d14ba8aa4c@scriptfusion.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: j.boggiano@seld.be (Jordi Boggiano) Hey Bilge, On 24.08.2024 18:49, Bilge wrote: > 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. Great work overall, I'm all for it and even though it's not something I saw myself using a whole lot, the json_encode example sold me on it being more useful than I initially thought. One question (sorry if someone already asked, I scanned the thread but it is getting long..): Taking this example from the RFC:     function g($p = null) {         f($p ?? default);     } Could you go one step further and use default by default but still allow null to be passed in?     function g($p = default) {         f($p);     } I suppose this would mean $p has to hold this "default" value until a function call is reached, at which point it would resolve to whatever the default is. This probably complicates things for very little gain but I had to ask. Best, Jordi