Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130799 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 EC09B1ADA7B for ; Thu, 7 May 2026 18:27:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1778178454; bh=oCFoZ1gQ0fVjhJN3NQzUie2ooXhrBPmSDWEIvF7P21Q=; h=Date:From:To:In-Reply-To:References:Subject:From; b=V3YRAbQkH/+nAD5IjsVNGJx/DYmml7N4lsSxAYPBx3yPVcwk+mbyPIEb35KLQmdKo IewgygiCUxFWN27Lur1X/KyzTa71uwSuWU9D8ptmK5/cvK7SoMVL64KAHCDofFYdip OzCEbZlFyZzuSvVQMQspLLbVefBPDoHSgHoW3R2UOTQrjn7ilKmRL4SrhSXarra1rs 7h3mMT8W7GZYrCpU+Z4WH18/M3zdgovUkD+L5c5op5vUpYBZ9fyZQ8mj0vREh0qkjb xcZtrGd8Vypjch8OZnggwmjQdljW8AYepUQ4fP2cdns+eP3n9Q0Fe0S7B9LqGduQTc fxp76SI5VzfQA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 117D31804F6 for ; Thu, 7 May 2026 18:27:33 +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.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-a2-smtp.messagingengine.com (fhigh-a2-smtp.messagingengine.com [103.168.172.153]) (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 ; Thu, 7 May 2026 18:27:20 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id BCF171400135 for ; Thu, 7 May 2026 14:27:14 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-04.internal (MEProxy); Thu, 07 May 2026 14:27:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm3; t=1778178434; x=1778264834; bh=d6IwxgJf3ys0FE0RB7Dmh kHB6IIO7TCNJDd52R0gWoc=; b=rU9r8y/Nm7Xrjn6MIG119dqYGCulIbmak4oCK sHLJ8qtWaZCgrHE7t6fD6QyeU+6G9x0iR2385IVRcZJEGQbboACjNsS1GO/3g3wc B1OBQk5pKsQ271vOe3CYYZX+0BI3H0o8N17NgF1/A9thCi10GG5ZUUGWy0/ITMRT YPH4AbFY0L5ixIWpwDGLlxh+W6GVqr+Wr+UN7xgjf+n/lq+xzh4o+DnQ69wqPXKx s/RptjodjDtOyXK+u2zMkcJyPx3x257rUvsbM9KoP+/3UYMz8yah8g0TOh8O0pdQ P1SbmgI9D8QpkPL8OqqqrU2j5w/P9WevNYyOVsth08qzEzR1Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1778178434; x=1778264834; bh=d 6IwxgJf3ys0FE0RB7DmhkHB6IIO7TCNJDd52R0gWoc=; b=pz4ACIvLh6f8aJwGM P+YsuSWSs5Iic7NBD4RvDGeNWl9ySIvjgxPTwKO7E5A+Q6to3zinU206x0krsiXU Ru2+THvDXGWsW99PRY+fJ2NFv8Lwt5oRY37qozN4r03Zt9fBlk18I3Ub6Vg8fGuk e885y5Oc6S4UQAOOY021V9liBKJRWZN+zu5eZgvQARd4AskkMB6HDl9sK3/6OKnW BeM7bhGrqKr1sUV6dD5L8WaDe8cKcxi1E5J/HA+52lmQswO2/XC269m1dMGhp/bm GBc4M5hg0P637s2TRSTJwodyenxNiz1yR7JWjOoIyGNVf1HEk8xxY9kmFPIbfPXF UvHRA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgddutdekudelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvffkjghfufgtgfesthejredtredttdenucfhrhhomhepfdfnrghrrhih ucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqe enucggtffrrghtthgvrhhnpedugedvlefgueegheefjeetffduveeltefhfeegjeffffel gedttdevkeegkedugfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomhdpnhgspghrtghp thhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepihhnthgvrhhnrghlsh eslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 858C4700065; Thu, 7 May 2026 14:27:14 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: A5IINf7gfDzc Date: Thu, 07 May 2026 13:26:54 -0500 To: "php internals" Message-ID: <069e8126-74ac-4c06-b591-ffd70d37ecfd@app.fastmail.com> In-Reply-To: <6B83B07A-0344-4149-BFE9-7F3DD21BBA39@rwec.co.uk> References: <0187D382-80FD-432C-B0D5-B0F9D8783419@hotmail.com> <6B83B07A-0344-4149-BFE9-7F3DD21BBA39@rwec.co.uk> Subject: Re: [PHP-DEV] [RFC] Scope functions Content-Type: text/plain Content-Transfer-Encoding: 7bit From: larry@garfieldtech.com ("Larry Garfield") On Thu, May 7, 2026, at 5:52 AM, Rowan Tommins [IMSoP] wrote: > For something like "run this in a transaction", the closure is really > acting like a poor man's "continuation": it creates two new stack > frames (transaction wrapper, callback) when what you really want is to > *interleave* the boilerplate and the case-specific code. > > In that sense, hygienic macros are probably the "ideal" solution - > everything is expanded inline into a single scope, and there's no > Closure object which can be misused. > > Context Managers could in fact be implemented as such a macro, and as I > understand it, the implementation is basically doing that internally by > manipulating ASTs. Correct. Absent a macro system like Rust, it's just a one-off compiler "macro" that turns into try-catch-finally. > I wonder if there's any "minimal" macro system which would allow this > kind of inline boilerplate expansion, without needing to design an > entire meta-language? The PFA implementation does generate new opcodes at runtime and cache them. So such things are possible. Wise to generalize or not is an entirely separate question, though. :-) --Larry Garfield