Re: [RFC] Pipe Operator

From: Date: Fri, 13 May 2016 17:18:06 +0000
Subject: Re: [RFC] Pipe Operator
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  Groups: php.internals 
Request: Send a blank email to internals+get-93317@lists.php.net to get a copy of this message
Hi Sara, Le 13/05/2016 à 00:41, Sara Golemon a écrit :
So we'd have to audit all 4k+ functions in the PHP runtime (and provide a mechanism for defining it on userspace functions)?
That's right, except that, if we only consider functions accepting more than 1 arg, we just need to check about 1,000 functions. It may seem a lot but, for a potential solution to such a long-time issue as argument ordering sadness, IMHO, it's worth the pain. I am currently doing it and I'll send you the list when it is ready. For userspace functions, the logic can be quite simple : 0 arg -> not usable in a pipeline, 1 arg or more -> substitute first arg. Then, we have 4 options : - consider that, when using a userland function in a pipeline, the lhs is always inserted in 1st position, - provide a function to change the position on an existing function (default = 0 when function is registered). A negative position would disable using the function in a pipeline, - enrich the syntax of function declaration to designate the arg to substitute. I would propose to start with the 1st choice. After people have the occasion to use it for a while, we will see if an additional mechanism is requested. Regards François

« previous php.internals (#93317) next »