Le 16/05/2016 à 19:53, Sara Golemon a écrit :
I think you're making a false equivalence here. One can see argument
ordering consistency as a serious problem without seeing a Heath
Robinson version of call chaining as the solution to it.
I appreciate that you want to seize onto any opportunity to fix the
argument ordering consistency problem, but I don't agree that this is
the fix for it.
I don't 'seize any opportunity' here. I just think that PHP would do a
great step forward if people could write :
$res = explode(' ', str_replace($from,$to,trim($input)));
as :
$input
|> trim()
|> str_replace($from,$to)
|> explode()
Eliminating the $$ is a natural complement to your RFC, IMO. It's not
something tricky or artificial I would add to an unrelated mechanism.
The question of function aliases is not so serious because we'll need very
few. Almost every functions have only one 'natural' argument to substitute
as lhs. I'm not sure I understand what you mean with 'but only in certain
situations'.
If it were so natural, wouldn't the original version of these
functions have been made "right" in the first place? I fear that the
only thing we'd gain by adding all these aliases is more functions,
but without the benefit of any improvement in the argument ordering
problem because now, instead of remembering which order the argument
is in, users have to remember which alias to call.
Right. That's why I propose we start without creating any function
alias. We're not supposed to allow writing anything in a pipeline. For
every functions, the substituted argument will always be the
haystack|subject|source|input argument. That's easy to remember.
Regards
François
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php