emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 71783e9: Add the string-numeric-lessp function


From: Paul Eggert
Subject: Re: master 71783e9: Add the string-numeric-lessp function
Date: Sun, 21 Feb 2016 19:50:16 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]