unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Glenn Morris <rgm@gnu.org>
Cc: michael_heerdegen@web.de, oscarfv@telefonica.net, 23902@debbugs.gnu.org
Subject: bug#23902: 25.1.50; Strange warning on string-collate-equalp's docstring
Date: Sat, 09 Jul 2016 20:21:49 +0300	[thread overview]
Message-ID: <83shvig21e.fsf@gnu.org> (raw)
In-Reply-To: <nlh9bypwpa.fsf@fencepost.gnu.org> (message from Glenn Morris on Sat, 09 Jul 2016 13:06:57 -0400)

> From: Glenn Morris <rgm@gnu.org>
> Cc: oscarfv@telefonica.net (Óscar Fuentes),
>   michael_heerdegen@web.de,  23902@debbugs.gnu.org
> Date: Sat, 09 Jul 2016 13:06:57 -0400
> 
> But no-one using Emacs will reason in this way.
> "I want to compare if two files are the same.
> I don't know about file-equal-p, so I will just do a string comparison
> of the filenames.
> I know that the MS Windows function to compare strings is CompareString.
> Therefore I will see which Emacs function uses that.
> Ah, it is string-collate-equalp.
> Therefore I will use string-collate-equalp to compare two file names.
> I won't use the more obvious string-equal, nor will I read the
> documentation of string-collate-equalp, which makes it obvious that this
> is wrong."

No, no one will reason this way.

But they can reason this way instead:

"I want to compare two file names.
Collation is a way to compare strings, for example the man page for
strcoll says the function returns zero if one string is equal to the
other.
And Emacs just learned how to use collation to compare strings, it
has this great new function string-collate-equalp.
Therefore, let's use string-collate-equalp for comparing two file
names."

> And suppose I have two strings, and want to know if they are equal,
> respecting my locale's convention about characters that are not
> literally identical, but have the same meaning. I should use
> string-collate-equalp for this. This is true whether the strings
> represent the names of elephants in a zoo, or files on a disk.

And that is exactly the fallacy that the note warns against.  Because
filesystems don't compare as equal characters that have the same
meaning, they compare bytes in a byte stream that is the file name in
its raw byte form, as recorded on disk.





  reply	other threads:[~2016-07-09 17:21 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-05 22:05 bug#23902: 25.1.50; Strange warning on string-collate-equalp's docstring Óscar Fuentes
2016-07-06 14:34 ` Eli Zaretskii
2016-07-06 15:08   ` Michael Heerdegen
2016-07-06 15:28     ` Eli Zaretskii
2016-07-06 15:46       ` Óscar Fuentes
2016-07-06 16:26         ` Eli Zaretskii
2016-07-06 17:44           ` Óscar Fuentes
2016-07-06 18:32             ` Eli Zaretskii
2016-07-09 17:06           ` Glenn Morris
2016-07-09 17:21             ` Eli Zaretskii [this message]
2016-07-09 21:36               ` Óscar Fuentes
2016-07-10  2:40                 ` Eli Zaretskii
2016-07-10  3:06                   ` Michael Heerdegen
2016-07-10 14:40                     ` Eli Zaretskii
2016-07-06 15:55       ` Michael Heerdegen
2016-07-06 16:30         ` Eli Zaretskii
2016-07-06 16:44           ` Michael Heerdegen
2016-07-06 17:18             ` Eli Zaretskii
2016-07-06 22:49               ` Michael Heerdegen
2016-07-07  2:38                 ` Eli Zaretskii
2016-07-07 21:52                   ` Michael Heerdegen
2016-07-08 10:11                     ` Eli Zaretskii
2016-07-08 20:59                       ` Michael Heerdegen
2016-07-09  6:52                         ` Eli Zaretskii
2016-07-09 17:06                           ` Richard Stallman
2016-07-09 22:59                             ` Michael Heerdegen
2016-07-06 15:48   ` Glenn Morris
2016-07-06 16:27     ` Eli Zaretskii

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=83shvig21e.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=23902@debbugs.gnu.org \
    --cc=michael_heerdegen@web.de \
    --cc=oscarfv@telefonica.net \
    --cc=rgm@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 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).