Re: Pipe Operator v2

From: Date: Fri, 20 Jan 2017 09:46:03 +0000
Subject: Re: Pipe Operator v2
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-97889@lists.php.net to get a copy of this message
On 20 January 2017 00:59:59 GMT+00:00, Levi Morrison <levim@php.net> wrote: > >I empathize that you don't like string-name callables (I really don't >like them either) but this RFC helps avoid the string if you want to. >Consider > > // without my proposal: > array_map('trim', $input) > > // with it: > array_map(trim($$), $input) Sure, like I said in my previous message, ($$) acts as a shorthand for Closure::fromCallable on any callable that takes one argument. But syntax for getting a reference to a function has been discussed before, and it would be a shame to be able to do it for this special case but not others. Straw manning, if name::fn got a reference to a function from its name, you could do: $foo |> trim::fn Which makes more sense than using a partial application operator without applying anything. Regards, -- Rowan Collins [IMSoP]

« previous php.internals (#97889) next »