Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129462 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 lists.php.net (Postfix) with ESMTPS id 2E5AF1A00BC for ; Wed, 26 Nov 2025 23:30:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1764199819; bh=EjeNTatAJMhbl/+/RSM/RqVaqDcb6JQXhBv9NuzF9tI=; h=Date:Subject:To:References:From:In-Reply-To:From; b=E3wzG3c/YH9gcW0NcjIrnce0VmsR3j91xk1dTUjU+tP2aanNSQFy82V5EwMN/M0ZQ T55cbqsTHuCXOGor+nR1U042tx2QLMesbTiobeOSU4RI7d4TexEGY5akNlp3+hjgrt Fs5buzdR50usbptSiEaEfJW/Pbaf74W+aEAvlKNrKlbJRXdr2lgaYPMCx84fCXQPy9 87uRlbqAmRNVbHcNJ+uSnTzYXzu/HRvvyygD0Kb5c5hKHSHgKWzHXb7ycqLFUG7Jrg BAj/hk5XxS6ao9Lq2GvrioHLvsOxOZr2Mfi5r8uCnK1rhHPG0ZPjGT4d5dd0fRuzEl SIb7ujB2uI9Rw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B862D180077 for ; Wed, 26 Nov 2025 23:30:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,DMARC_MISSING, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from jessie.smtp.mailx.hosts.net.nz (jessie.smtp.mailx.hosts.net.nz [43.245.52.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 26 Nov 2025 23:29:59 +0000 (UTC) Received: from 122-57-27-239-adsl.sparkbb.co.nz ([122.57.27.239] helo=[192.168.1.67]) by jessie.smtp.mailx.hosts.net.nz with esmtpsa authed as varteg.nz (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim 4.96) (envelope-from ) id 1vOOxK-003bkH-2f for internals@lists.php.net; Thu, 27 Nov 2025 12:29:50 +1300 Message-ID: Date: Thu, 27 Nov 2025 12:29:29 +1300 Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [RFC] Context Managers To: internals@lists.php.net References: <5c6a17a8-e3af-4c9a-90bb-3e4a471e4a49@app.fastmail.com> Content-Language: en-GB In-Reply-To: <5c6a17a8-e3af-4c9a-90bb-3e4a471e4a49@app.fastmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Hosts-DKIM-Check: none From: weedpacket@varteg.nz (Morgan) On 2025-11-27 06:48, Larry Garfield wrote: > > * Is there any interest in turning `using` into an expression rather than a statement, so that it can be used in expression contexts? > What would it evaluate to? The value returned by exitContext()? That's already controlling whether caught exceptions are rethrown, so the only value that would ever reach an enclosing expression would be "true". (I've sometimes thought about making `return` an expression in the same spirit as `throw`. Its evaluated type would of course be "never" since any enclosing expression would be abandoned.) Morgan