> On 29 Jan 2019, at 07:13, Girgias <george.bany...@gmail.com> wrote:
> 
> On Thu, 24 Jan 2019 at 01:25, Dan Ackroyd <dan...@basereality.com> wrote:
> 
>> On Wed, 23 Jan 2019 at 17:25, Girgias <george.bany...@gmail.com> wrote:
>> 
>>> I understand the rationale for functional programming, may I ask
>>> in your opinion should PHP have built-in functions for arithmetic
>>> operations so that it can be used in such a way without needing userland
>>> implementations?
>> 
>> No, but only I'd much strongly prefer we have some syntax for defined
>> 'short closures' ala Javascript:
>> 
>> $values = [1, 2, 3];
>> $bar = array_map($x => $x + 1, $values);
>> 
>> // $values === [2, 3, 4];
>> 
>> as those cover much more than the basic arithmetic operations, are
>> nice and readable after you've used them a few times.
>> 
>> cheers
>> Dan
>> Ack
>> 
> 
> I didn't even know you could omit parenthesis in JS closures, the more you
> know.
> But it seems like there is already a Draft for an RFC for short closures in
> PHP but
> that one seems to have come to a halt.
> 
> I've realised I didn't go through array functions so just gonna bring them
> up for the sake of not creating a new thread:
> 
> 
>   - key_exist - alias of array_key_exist
>   A GitHub search brings up 276 078 results where there are some userland
>   usage but also a whole lot of unit tests usage
>   https://github.com/search?l=PHP&p=1&q=key_exists&type=Code
>   - pos - alias for current
>   Can't seem to get any meaningful result by searching on GitHub as it
>   picks up more or less anything which contains pos
>   https://github.com/search?l=PHP&q=pos%28&type=Code
>   - sizeof - alias of count
>   A Github search brings up 1 617 789 results with lots of userland usage
>   but also a bit of unit testing
>   https://github.com/search?l=PHP&p=1&q=sizeof&type=Code
> 
> And then there is *array_multisort* a function which has a signature which
> isn't even possible in userland code.
> (https://secure.php.net/manual/en/function.array-multisort.php).
> Other than the fact that this function's documentation isn't totally
> correct in my opinion I did a Github search to see if people use it.
>> From what I've seen in the search results [1], around 620k, it is only used
> in phpt unit tests and a unit test of a parser.
> 
> Now, I don't think a function which doesn't follow normal function
> signature converntion (or isn't even possible) shouldn't really be part of
> the language.
> Moreso that it seems barely anybody uses it.
> What's people opinion on deprecating array_multisort ?
> 
> [1]
> https://github.com/search?l=PHP&o=desc&p=1&q=array_multisort&s=&type=Code
> 
> George P. Banyard


My opinion on deprecating array_multisort is: don’t. 

Plenty of provided functionality exists specifically because it’s stuff that’s 
not feasible or not efficient to do in userland.

Given the fairly unique capabilities of array_multisort, what is your suggested 
replacement for the half-million instances on GitHub alone (lets not forget 
that GitHub is not the single repository of all code ever written, and the 
search you’ve referenced is only public repos)?

If array_multisort is viable for deprecation, surely array_fill is as well? At 
least that one is replaceable with a simple userland implementation. What about 
array_rand? Or array_product - that has a paltry 31K results on GitHub. Or 
array_chunk, that’s only 2/3 as many results as for array_multisort.

Heck, why not remove all built in functions and just force everyone to write 
the entire runtime from scratch in userland code?


In case you didn’t realise, this is sarcasm at the extreme, because your given 
reasons to support deprecation are absurd.




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

Reply via email to