[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: string> missing?
From: |
Thibaut Verron |
Subject: |
Re: string> missing? |
Date: |
Thu, 4 Jun 2015 07:30:08 +0200 |
2015-06-04 0:25 GMT+02:00 Stefan Monnier <address@hidden>:
>
> > testing strings for equality in emacs lisp is already tricky enough!
>
> Now, regardless of whether I agree with the rest of what is being said
> in this thread, this part really puzzles me. I do think there are some
> tricky/subtle issues in string equality testing in Emacs, but these are
> sufficiently subtle that most people will never know about them.
>
> So, what are you referring to here?
>
Mostly to this:
(setq str1 "foo")
(setq str2 "foo")
(setq str3 str1)
(= str1 str2) ;;==> *error*
(eq str1 str2) ;;==> nil
(eq str1 "foo") ;;==> nil
(eq str1 str3) ;;==> nil
(string= str1 str2) ;;==> t
The first two candidates for a newcomer to string testing don't return
the expected result, because = is really number=, and eq does not test
for structural equality (and is basically useless for strings, as I
understand it). Now maybe tricky is a strong word, after all it is
properly documented once you notice the issue. And I wouldn't be able
to suggest a better way of exposing these functions.
For the thread at hand, obviously if one is looking for a string>
function, one knows about string=. But I can't help but imagine a
developer running into both annoyances on the same day: the first one
has deep roots, but the second one is trivial to fix, couldn't we
spare him that?
Thibaut
- Re: string> missing?, (continued)
- Re: string> missing?, Alan Mackenzie, 2015/06/03
- Re: string> missing?, Eli Zaretskii, 2015/06/03
- Re: string> missing?, Nick Andryshak, 2015/06/03
- Re: string> missing?, Eli Zaretskii, 2015/06/03
- Re: string> missing?, Nick Andryshak, 2015/06/03
- Re: string> missing?, Jay Belanger, 2015/06/03
- Re: string> missing?, Nick Andryshak, 2015/06/03
- Re: string> missing?, Jay Belanger, 2015/06/03
- Re: string> missing?, Thibaut Verron, 2015/06/03
- Re: string> missing?, Stefan Monnier, 2015/06/03
- Re: string> missing?,
Thibaut Verron <=
- Re: string> missing?, Nicolas Richard, 2015/06/04
- Re: string> missing?, Thibaut Verron, 2015/06/04
- Re: string> missing?, Stefan Monnier, 2015/06/04
- Re: string> missing?, Stefan Monnier, 2015/06/03
- Re: string> missing?, Eli Zaretskii, 2015/06/03
- Re: string> missing?, Tassilo Horn, 2015/06/04
- Re: string> missing?, Bozhidar Batsov, 2015/06/04
- Gnus & Mail-Followup-To (was: string> missing?), Nicolas Richard, 2015/06/04
- Re: Gnus & Mail-Followup-To, Tassilo Horn, 2015/06/04
- Re: Gnus & Mail-Followup-To, Nicolas Richard, 2015/06/04