From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: master 71783e9: Add the string-numeric-lessp function Date: Sun, 21 Feb 2016 20:16:56 -0800 Organization: UCLA Computer Science Department Message-ID: <56CA8BB8.6040908@cs.ucla.edu> References: <20160221043348.25201.81719@vcs.savannah.gnu.org> <87twl2fzaw.fsf@gnus.org> <56CA2C66.7040306@cs.ucla.edu> <87povpzc9c.fsf@gnus.org> <56CA8578.2030004@cs.ucla.edu> <87twl1xul1.fsf@gnus.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1456114637 8426 80.91.229.3 (22 Feb 2016 04:17:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 22 Feb 2016 04:17:17 +0000 (UTC) Cc: emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 22 05:17:08 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aXhvo-0005mP-1v for ged-emacs-devel@m.gmane.org; Mon, 22 Feb 2016 05:17:08 +0100 Original-Received: from localhost ([::1]:46821 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXhvn-0007J9-8N for ged-emacs-devel@m.gmane.org; Sun, 21 Feb 2016 23:17:07 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52511) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXhvk-0007IN-NF for emacs-devel@gnu.org; Sun, 21 Feb 2016 23:17:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXhvf-0003OI-MW for emacs-devel@gnu.org; Sun, 21 Feb 2016 23:17:04 -0500 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:60329) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXhvf-0003OE-Gt for emacs-devel@gnu.org; Sun, 21 Feb 2016 23:16:59 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id DE551160193; Sun, 21 Feb 2016 20:16:57 -0800 (PST) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id EiTLtxf7azHY; Sun, 21 Feb 2016 20:16:57 -0800 (PST) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 353AB160FC1; Sun, 21 Feb 2016 20:16:57 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 6eFwfmy_-3dt; Sun, 21 Feb 2016 20:16:57 -0800 (PST) Original-Received: from [192.168.1.9] (pool-100-32-155-148.lsanca.fios.verizon.net [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 15D63160193; Sun, 21 Feb 2016 20:16:57 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 In-Reply-To: <87twl1xul1.fsf@gnus.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 131.179.128.68 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:200434 Archived-At: Lars Ingebrigtsen wrote: > I don't think that's something our numerical string comparison function > should be doing. Again, I'm not sure I'm following. The two strings "2.21-0ubuntu4" and "2.21-0ubuntu4.1" are identical except the latter has ".1" appended. Shouldn't almost any sane kind of string comparison consider the shorter to be less than the longer? If only some strings are valid for comparison, I suppose the comparison function could be a partial function, e.g., it could signal an error when given a string that it doesn't think has a valid format. This of course could be done, but it makes usage more complicated. For sorting, having comparison functions be total functions is much simpler to explain. At least, that's been the tradition in other GNU tools. GNU ls -v applies the string-version-lessp algorithm to every pair of file names that it considers, and it works on arbitrary file names. It sounds like you may be thinking of some other tradition, although I'm not sure what that tradition would be. The GNU ls -v approach works well in practice, because people who care about version numbers tend to name their files consistently. E.g., they do not put files "foo001.png" "foo1.png" in the same directory, because that kind of usage would confuse humans no matter what 'ls -v' does.