Well, while I'm sending e-mails...

Unrelated to the Comparable RFC, are there any objections to adding a
function that simply wraps compare_function()? It's depressingly
common to end up writing a construct like the following in comparison
callbacks, so I think we might as well encapsulate the pattern in an
actual function:

if ($a < $b) {
  return -1;
}
elseif ($a > $b) {
  return 1;
}
return 0;

If I don't hear kicking and screaming in the next few days, I'll slip
this into trunk. I can provide a patch/RFC in advance if there's
demand, but it'll be about as simple as you imagine. :)

The one thing that I would like bikeshedding^Wfeedback on is the name:
cmp() makes the most sense to me, since it lines up well with Python
and (to a lesser extent) Perl, but if there are concerns about
potential name clashes with existing code, may I suggest
var_compare(). Get your votes and/or suggestions in!

Thanks,

Adam

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

Reply via email to