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


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to