Re: [RFC] Comparable: the revenge

From: Date: Thu, 19 Feb 2015 22:35:06 +0000
Subject: Re: [RFC] Comparable: the revenge
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-83246@lists.php.net to get a copy of this message
>> But even here I would rather just take a function instead of requiring >> it to be the instance of some interface: >> >> function sort($input, callable $comparator($a, $b): int) { >> /* … */ >> } > > Fair, but the sorting case isn't the only one that matters, > particularly with <=> now as part of the language. For completeness: I advocate accepting a comparator in every case where custom comparison logic is needed, not just for sorting.

« previous php.internals (#83246) next »