unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Toru TSUNEYOSHI <t_tuneyosi@hotmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: enable sorting by version in `ls-lisp-handle-switches'
Date: Thu, 11 Mar 2010 14:20:21 -0500	[thread overview]
Message-ID: <jwvaaued6at.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20100312.030317.128157175.tune@to.email.ne.jp> (Toru TSUNEYOSHI's message of "Fri, 12 Mar 2010 03:03:17 +0900")

>> You may also want to take a look at mpc-compare-strings which does
>> something similar, tho simpler (not specific to versions, just taking
>> care of numbers).
> I checked `mpc-compare-strings'.
> `mpc-compare-strings' and `string-logical-lessp' are different.

Indeed, I don't expect them to behave identically.

>   (mpc-compare-strings "01-00001" "1-1") => 1
>   (string-logical-lessp "01-00001" "1-1") => nil

>   (mpc-compare-strings "1-1" "01-00001") => -1
>   (string-logical-lessp "1-1" "01-00001") => nil

I remember having struggled over "correct" handling (meaning, making
sure that it's transitive) of leading zeroes in
mpc-compare-strings, so I'm not very surprised.

I don't really care whether "1-1" is considered larger, smaller or
equivalent to "01-00001".  I don't think such issues show up much in
practice and I'm not sure as a user I'd prefer one over the other.

The implementation strategy is also very different, so I'd expect the
performance behavior to be quite different as well.


        Stefan




  parent reply	other threads:[~2010-03-11 19:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-07  4:46 enable sorting by version in `ls-lisp-handle-switches' Toru TSUNEYOSHI
2010-03-07 14:49 ` Stefan Monnier
     [not found]   ` <20100312.030317.128157175.tune@to.email.ne.jp>
2010-03-11 19:20     ` Stefan Monnier [this message]
2010-03-12  5:31       ` Toru TSUNEYOSHI
2010-03-12  7:00     ` Toru TSUNEYOSHI

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwvaaued6at.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=t_tuneyosi@hotmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).