From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: version comparison functions Date: Fri, 26 Aug 2005 14:42:40 +0200 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1125062047 24944 80.91.229.2 (26 Aug 2005 13:14:07 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 26 Aug 2005 13:14:07 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Aug 26 15:13:59 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1E8dzm-0005U8-J5 for ged-emacs-devel@m.gmane.org; Fri, 26 Aug 2005 15:11:47 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E8e3h-0002oG-QO for ged-emacs-devel@m.gmane.org; Fri, 26 Aug 2005 09:15:49 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1E8dgD-0008DJ-LF for emacs-devel@gnu.org; Fri, 26 Aug 2005 08:51:33 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1E8dd0-00070q-RT for emacs-devel@gnu.org; Fri, 26 Aug 2005 08:48:16 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E8dd0-0006yO-3f for emacs-devel@gnu.org; Fri, 26 Aug 2005 08:48:14 -0400 Original-Received: from [195.41.46.236] (helo=pfepb.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.34) id 1E8dZh-00082r-7S; Fri, 26 Aug 2005 08:44:49 -0400 Original-Received: from kfs-l.imdomain.dk.cua.dk (unknown [80.165.4.124]) by pfepb.post.tele.dk (Postfix) with SMTP id 3FAEE5EE0A6; Fri, 26 Aug 2005 14:43:08 +0200 (CEST) Original-To: Juanma Barranquero In-Reply-To: (Juanma Barranquero's message of "Fri, 26 Aug 2005 12:25:51 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:42422 Archived-At: Juanma Barranquero writes: >> version< is useful for comparing version number strings. > So I suppose I'm just a bit surprised at the thought of adding two > variables, seven functions and one alias just to do version > comparison. Not even the `integer-list-*' functions are general, as > they consider '(1) and '(1 0) to be equal, which doesn't strike me as > a very common need. They would be better named `version-list-*', IMO. I agree -- and I just changed their names accordingly. I also fixed a bug that caused e.g. (version< "1" "1.0") to trap. Finally, I changed version= from being an alias for string-equal to using the provided version-list-= function. Before my change: (version< "1" "1.0") => nil (version<= "1" "1.0") => t (version= "1" "1.0") => nil With my change, it gives the logical result. (version= "1" "1.0") => t I don't know the rationale for aliasing version= to string-equal, but to me it was logically wrong to do so -- and if someone wants to use string-equal, they should do so! BTW, I agree with Juanma that this is hardly the time to add this stuff... ..but now that it has happened, I think it makes sense for these functions to accept an optional argument to limit the number of version string elements to compare. E.g. (version= "22.0.50" "22.0.50.37") => nil (version= "22.0.50.36" "22.0.50.37") => nil (version= "22.0.50" "22.0.50.37" 3) => t (version= "22.0.50.36" "22.0.50.37" 3) => t -- Kim F. Storm http://www.cua.dk