> On 19 Jan 2015, at 05:03, Rasmus Lerdorf <ras...@lerdorf.com> wrote:
> 
> On 01/18/2015 09:00 PM, Andrea Faulds wrote:
>> That would also mean a future sorting API could unify user sorts and 
>> non-user sorts: just make the default callback be cmp().
>> 
>> Usage would be like this:
>> 
>> cmp(1, 2); // 1
>> cmp(1, 1); // 0
>> cmp(2, 1); // 1
>> 
>> Essentially, exactly like the spaceship in Perl, but a function.
>> 
>> Thoughts?
> 
> Well, if you really meant that would be the output, perhaps we should
> get someone else to write it. :)

I noticed that erratum the moment after I sent the email. Oh, if only emails 
could be edited *after* being sent…

The output would be:

cmp(1, 2); // -1
cmp(1, 1); // 0
cmp(2, 1); // 1

There should’ve been a minus sign on the third one, a typo. But I’d forgotten 
that comparison functions actually go the other way round.

I suppose this proves my point that cmp() would make things easier ;)

--
Andrea Faulds
http://ajf.me/





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

Reply via email to