From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: tomas@tuxteam.de Newsgroups: gmane.emacs.help Subject: Re: `compare-strings' style question Date: Fri, 20 Nov 2009 08:00:39 +0100 Message-ID: <20091120070039.GC30194@tomas> References: <878we2kakq.fsf@lola.goethe.zz> <87einuij59.fsf@lola.goethe.zz> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; x-action=pgp-signed Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1258701011 963 80.91.229.12 (20 Nov 2009 07:10:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 20 Nov 2009 07:10:11 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Nov 20 08:10:04 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NBNd5-0004vS-IM for geh-help-gnu-emacs@m.gmane.org; Fri, 20 Nov 2009 08:10:03 +0100 Original-Received: from localhost ([127.0.0.1]:52236 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NBNd4-0000Qv-W4 for geh-help-gnu-emacs@m.gmane.org; Fri, 20 Nov 2009 02:10:03 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NBNb7-0008ND-D9 for help-gnu-emacs@gnu.org; Fri, 20 Nov 2009 02:08:01 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NBNb2-0008L3-1w for help-gnu-emacs@gnu.org; Fri, 20 Nov 2009 02:08:00 -0500 Original-Received: from [199.232.76.173] (port=59176 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NBNb1-0008Kv-Oq for help-gnu-emacs@gnu.org; Fri, 20 Nov 2009 02:07:55 -0500 Original-Received: from alextrapp1.equinoxe.de ([217.22.192.104]:45338 helo=www.elogos.de) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NBNb1-0005CB-BH for help-gnu-emacs@gnu.org; Fri, 20 Nov 2009 02:07:55 -0500 Original-Received: by www.elogos.de (Postfix, from userid 1000) id CD7AE90048; Fri, 20 Nov 2009 08:00:39 +0100 (CET) Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.15+20070412 (2007-04-11) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:69962 Archived-At: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thu, Nov 19, 2009 at 03:54:20PM -0500, Barry Margolin wrote: > In article <87einuij59.fsf@lola.goethe.zz>, David Kastrup = =20 > wrote: [...] > > In my opinion, t was the wrong choice for a match. nil would have be= en > > much better because you can't use the result of compare-strings as a > > condition. > >=20 > > But I suppose there is not much one can do now because of compatibili= ty. >=20 > That would still be weird, because >=20 > (not (compare-strings ...)) >=20 > would be the way to tell if they're equivalent. C has the same problem= =20 > with its strcmp() function, which returns negative, 0, or positive,=20 > where 0 is C's falsehood. Yes, that would be a similar problem as C, where zero's alter ego is false. It still looks a bit funny to say if(!strcmp(foo, bar)) ... ...but at least, it's just a problem of name choice (more appropriate would have been something along the lines of strdiff). > The basic problem is that IF is designed to work with binary predicates= ,=20 > and this operation is trinary. >=20 > Maybe compare-strings should have been defined like strcmp, returning 0= =20 > for the middle case. Then you wouldn't be tempted to think of it as a=20 > predicate. (zerop (compare-strings ...)) doesn't seem as weird as (not= =20 > (compare-strings ...)). Yes, I would have preferred this choice (but nil would have been fine too). Thanks - -- tom=C3=A1s -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFLBj6XBcgs9XrR2kYRAsz/AJ47RD83WcbAmKNJ3zDVO2RLorOEXwCePi9z q0SAJuLd7lCI6MHoi2ShLlw=3D =3DD4Be -----END PGP SIGNATURE-----