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 19:50:16 -0800 Organization: UCLA Computer Science Department Message-ID: <56CA8578.2030004@cs.ucla.edu> References: <20160221043348.25201.81719@vcs.savannah.gnu.org> <87twl2fzaw.fsf@gnus.org> <56CA2C66.7040306@cs.ucla.edu> <87povpzc9c.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 1456113058 20213 80.91.229.3 (22 Feb 2016 03:50:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 22 Feb 2016 03:50:58 +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 04:50:49 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 1aXhWL-000748-15 for ged-emacs-devel@m.gmane.org; Mon, 22 Feb 2016 04:50:49 +0100 Original-Received: from localhost ([::1]:46681 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXhWH-0004Wo-9X for ged-emacs-devel@m.gmane.org; Sun, 21 Feb 2016 22:50:45 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47478) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXhVv-0004Wh-2O for emacs-devel@gnu.org; Sun, 21 Feb 2016 22:50:24 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXhVr-00061T-Sv for emacs-devel@gnu.org; Sun, 21 Feb 2016 22:50:23 -0500 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:59522) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXhVr-00061P-MX for emacs-devel@gnu.org; Sun, 21 Feb 2016 22:50:19 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id D771D160193; Sun, 21 Feb 2016 19:50:18 -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 FFHv-KpICMJQ; Sun, 21 Feb 2016 19:50:17 -0800 (PST) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id E51D1160FC1; Sun, 21 Feb 2016 19:50:17 -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 MrWv3JS8SzGt; Sun, 21 Feb 2016 19:50:17 -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 96200160193; Sun, 21 Feb 2016 19:50:17 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 In-Reply-To: <87povpzc9c.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:200428 Archived-At: Lars Ingebrigtsen wrote: > Looks nice, but I don't think that's a very good function name. It > sounds like something that is only meant to be used for version strings, > instead of something that happens to work on version strings as well.. Not quite sure I'm following. Every string is a version string. The function name was inspired by glibc's strverscmp; see: http://www.gnu.org/software/libc/manual/html_node/String_002fArray-Comparison.html#index-strverscmp Please feel free to change the name. > And is this supposed to be this way? > > (string-version-lessp "foo001.png" "foo1.png") Yes, if the version numbers and everything else result in a tie, it falls back on straight lexicographic comparison. Having the function be anything other than a total order would cause problems in sorting functions that use it to compare. Oh, and in response to one of your other questions: this function should be useful for package versions as well as file names. For example, I recently updated my libc-bin version on Ubuntu from 2.21-0ubuntu4 to 2.21-0ubuntu4.1 as part of the getaddrinfo security update.