help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Is there any difference between `equal' and `string=' for strings?


From: Jean Louis
Subject: Re: Is there any difference between `equal' and `string=' for strings?
Date: Thu, 19 Aug 2021 09:21:10 +0300
User-agent: Mutt/2.0.7+183 (3d24855) (2021-05-28)

* Marcin Borkowski <mbork@mbork.pl> [2021-08-19 07:57]:
> Well, of course a string and a symbol can never be `equal', but they can
> be `string='.  But what if both arguments are strings?  The docstrings
> seem to imply that you can use `equal' and `string=' interchangeably and
> they will always give the exact same result.  Is that correct?

(string-equal 123 "123") -- gives error, as string= is alias for
string-equal that is to handle exclusively strings.

(equalp 123 "123") -- does not give error.

Sometimes program outputs different types, could be `nil' or `string'
and those outputs maybe need to be expected as any type or as
exclusively strings. That is where the difference comes handy, as
sometimes I do want to get error report. If I wish to test strings I
better use `string='


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



reply via email to

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