From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: enable sorting by version in `ls-lisp-handle-switches' Date: Thu, 11 Mar 2010 14:20:21 -0500 Message-ID: References: <20100312.030317.128157175.tune@to.email.ne.jp> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1268335309 18631 80.91.229.12 (11 Mar 2010 19:21:49 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 11 Mar 2010 19:21:49 +0000 (UTC) Cc: emacs-devel@gnu.org To: Toru TSUNEYOSHI Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 11 20:21:45 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Npnx3-0000P9-7W for ged-emacs-devel@m.gmane.org; Thu, 11 Mar 2010 20:21:45 +0100 Original-Received: from localhost ([127.0.0.1]:51086 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Npnx2-0007Ef-91 for ged-emacs-devel@m.gmane.org; Thu, 11 Mar 2010 14:21:44 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Npnvk-0005hs-0Y for emacs-devel@gnu.org; Thu, 11 Mar 2010 14:20:24 -0500 Original-Received: from [140.186.70.92] (port=50135 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Npnvj-0005h2-1I for emacs-devel@gnu.org; Thu, 11 Mar 2010 14:20:23 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Npnvi-0000Je-DF for emacs-devel@gnu.org; Thu, 11 Mar 2010 14:20:23 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183]:17320 helo=ironport2-out.pppoe.ca) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Npnvi-0000JV-9b for emacs-devel@gnu.org; Thu, 11 Mar 2010 14:20:22 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEALfQmEtLd+qv/2dsb2JhbACaYHS9QIR7BIMXh3U X-IronPort-AV: E=Sophos;i="4.49,622,1262581200"; d="scan'208";a="58022780" Original-Received: from 75-119-234-175.dsl.teksavvy.com (HELO pastel.home) ([75.119.234.175]) by ironport2-out.pppoe.ca with ESMTP; 11 Mar 2010 14:20:21 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 5585B81C2; Thu, 11 Mar 2010 14:20:21 -0500 (EST) In-Reply-To: <20100312.030317.128157175.tune@to.email.ne.jp> (Toru TSUNEYOSHI's message of "Fri, 12 Mar 2010 03:03:17 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.93 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. 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:121827 Archived-At: >> 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