Re: Pipe Operator v2

From: Date: Thu, 19 Jan 2017 18:12:30 +0000
Subject: Re: Pipe Operator v2
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-97880@lists.php.net to get a copy of this message
Le 19/01/2017 à 13:54, Levi Morrison a écrit :
The |> symbol would be the piping operator with these semantics:
     1. Evaluate the left-hand side.
     2. Evaluate the right-hand side. Assert that the result is callable.
     3. Pass the result from 1. as the single argument to 2.
May I suggest extending your 3rd rule to : when the right hand side has the form of a function call, insert the result from 1. as first argument of 2. This way, right hand side may specify additional arguments. Based on the fact that, in 99% of PHP builtin functions where the concept applies, the 'input' argument is the first one. Example : $string |> trim('.,;:') $string |> trim() IMO, not acceptable : $string |> trim Regards François

« previous php.internals (#97880) next »