all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: storm@cua.dk (Kim F. Storm)
Cc: rms@gnu.org, emacs-devel@gnu.org
Subject: Re: version comparison functions
Date: Fri, 26 Aug 2005 14:42:40 +0200	[thread overview]
Message-ID: <m3irxsg98f.fsf@kfs-l.imdomain.dk> (raw)
In-Reply-To: <f7ccd24b05082603252ef00b92@mail.gmail.com> (Juanma Barranquero's message of "Fri, 26 Aug 2005 12:25:51 +0200")

Juanma Barranquero <lekktu@gmail.com> 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 <storm@cua.dk> http://www.cua.dk

  reply	other threads:[~2005-08-26 12:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-25 11:09 version comparison functions Juanma Barranquero
2005-08-26  9:54 ` Richard M. Stallman
2005-08-26 10:25   ` Juanma Barranquero
2005-08-26 12:42     ` Kim F. Storm [this message]
2005-08-26 13:24       ` Jason Rumney
2005-08-26 13:41         ` David Kastrup
2005-08-26 15:08         ` Michael Welsh Duggan
2005-08-28  2:44         ` Richard M. Stallman
2005-08-26 12:53     ` Jason Rumney
2005-08-26 22:34       ` Juanma Barranquero
2005-08-27  3:41     ` Richard M. Stallman
2005-08-26 13:36   ` Kim F. Storm
2005-08-26 15:47   ` Stefan Monnier
2005-08-26 22:36     ` Juanma Barranquero
2005-08-26 23:41       ` Vinicius Jose Latorre
2005-08-27 17:03         ` Juanma Barranquero

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3irxsg98f.fsf@kfs-l.imdomain.dk \
    --to=storm@cua.dk \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.