|
From: | Paul Eggert |
Subject: | Change Emacs 'sort' API to use three-way comparison |
Date: | Fri, 29 Aug 2014 14:19:44 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 |
To fix this I propose changing the API for 'sort' so that its function argument is no longer a predicate, but instead returns a negative integer, 0, or a positive integer. For compatibility with old code, it would treat nil as if it were nonpositive (thus requiring a reverse comparison) and noninteger nonnil values as if they were positive. This wouldn't be 100% upward-compatible, because if an existing predicate returns a nonpositive integer to stand for 'true' there will be a silent change to behavior, but I expect such usage is so rare that we don't need to worry about it.
[Prev in Thread] | Current Thread | [Next in Thread] |