Re: [RFC] Partial Function Application v2

From: Date: Tue, 14 Oct 2025 13:29:24 +0000
Subject: Re: [RFC] Partial Function Application v2
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-128835@lists.php.net to get a copy of this message
On Mon, Oct 13, 2025, at 4:00 PM, Tim Düsterhus wrote: > Hi > > I'll give the RFC another read at a later point, but I wanted to get > something out before I forget: > > Am 2025-10-13 20:23, schrieb Larry Garfield: >>> - How does it interact with compact(), specifically: >>> >>> $partial = compact(someValue(), ?); >>> >>> Would the ? be able to capture a variable containing >>> the return >>> value >>> of someValue()? >> >> Good question! compact(), extract(), etc. can't actually work with >> PFA, because they operate on the ambient context, which PFA by design >> changes. I've updated the RFC to note three incompatible core >> functions. (The other is func_get_arg()). > > - get_defined_vars() should be added to the list (possibly > more?). Or > to make things easier: Just say everything that doesn't already work > with FCC will not work with PFA either. > - What will happen with assert(?)? Assert is special in that it > > captures the AST at compile time to render it in the error message. So > specifically: > > $x = assert(?); > assert(false); // How will the AssertionError look like? > > Best regards > Tim Düsterhus I've added assert() and get_defined_vars() to the list, and relabeled it to be incomplete. I also added a note about FCC and it being the same list. --Larry Garfield

« previous php.internals (#128835) next »