From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Re: 7 logical-xor implementations in source tree Date: Thu, 25 Jul 2019 14:07:00 +0200 Message-ID: <5B633129-B795-4BFA-AE81-FE9FD0A24CE9@acm.org> References: <87tvbd9a8p.fsf@oremacs.com> <87pnm14u95.fsf@tcd.ie> <87sgqvoz5c.fsf@tcd.ie> <87d0hz2e11.fsf@tcd.ie> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_5377160B-2DAF-4766-8929-26E6D7660573" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="13837"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Oleh Krehel , Stefan Monnier , emacs-devel@gnu.org To: "Basil L. Contovounesios" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 25 14:07:26 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hqcWq-0003Qo-7t for ged-emacs-devel@m.gmane.org; Thu, 25 Jul 2019 14:07:24 +0200 Original-Received: from localhost ([::1]:59536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqcWo-0003GA-4e for ged-emacs-devel@m.gmane.org; Thu, 25 Jul 2019 08:07:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58400) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqcWl-0003Ep-Ia for emacs-devel@gnu.org; Thu, 25 Jul 2019 08:07:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hqcWk-0003q1-Es for emacs-devel@gnu.org; Thu, 25 Jul 2019 08:07:19 -0400 Original-Received: from mail154c50.megamailservers.eu ([91.136.10.164]:45722 helo=mail50c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hqcWj-0003i0-Rx for emacs-devel@gnu.org; Thu, 25 Jul 2019 08:07:18 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1564056424; bh=Gdr7M9teTbFj2GQYDmO1HJ/R4CVqopn7AV6QXRYpkq0=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=cCdTdSmjhO3GdJWTsjBUrh5sajvutHzs2CtdF9JNN7ZSoh9W6+RdRbD+6Eo5ORgdP LlwZBRRGErPlrs2Dc5Fw/ZwnL6zRSEnLdP/L+hT0BsdLSZGCXE30KzlTbs5SS4vo74 NIKageHQsXFp4+n0eOU9anM742F58W3Uod5o6eCA= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.0.4] ([188.150.171.71]) (authenticated bits=0) by mail50c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id x6PC71Xs010514; Thu, 25 Jul 2019 12:07:02 +0000 In-Reply-To: <87d0hz2e11.fsf@tcd.ie> X-Mailer: Apple Mail (2.3445.104.11) X-CTCH-RefID: str=0001.0A0B0213.5D399B68.0038, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=U/y889ju c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=iRZporoAAAAA:8 a=cJGp8Is6P7Q2SNXs44QA:9 a=CjuIK1q_8ugA:10 a=sky2FKVSad-2TdFqsIsA:9 a=ITdVHhY7-e0A:10 a=NOBgFS-JBQ2l-kSd6-zu:22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 91.136.10.164 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:238887 Archived-At: --Apple-Mail=_5377160B-2DAF-4766-8929-26E6D7660573 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 25 juli 2019 kl. 01.44 skrev Basil L. Contovounesios : > Stefan Monnier writes: >> - The name is too much like "equal/eq/eql": we need something much >> more explicit to avoid adding to the already existing confusion. >> I'd go with something like `bool-equal`. bool-equal, bool-equiv, bool=3D, bool-eq are all fine as far as I'm = concerned. `xnor' and `nxor', not so much. Racket has `boolean=3D?', but presumably it only copes with #t/#f. I'll be using `equiv' as placeholder below for brevity. >> - The fact that it's not a function is a definite downside. >=20 > Sure, though I'm interested to hear arguments to the contrary. Small catalogue of arguments: For a dyadic function, defsubst, or define-inline: mirrors the other = equivalence predicates. Simplicity. Can be used in HOFs. Most common = case. For a variadic macro: short-circuits, like `and' and `or'. Dramatically = simplifies use with 3 or more arguments. For macro and define-inline: Fast; no abstraction penalty. Since = conditions are boolean expressions themselves, may benefit from bytecode = optimisations. Against macro and define-inline: static byte-code size increase if = arguments are complex expressions, since some of them will be expanded = twice. For and against defsubst: compromise between space and size; slightly = slower and sometimes smaller than a macro. >> - There's no use for it, currently. If we can't find any use for it, >> I'm not sure it deserves to be in subr.el. It's hard to say how many times either of the operators would have been = used in the past had they being known, since there are many ways of = open-coding the logic depending on the circumstances. (Examples from a = simple pattern search at the end.) >> Actual/potential uses of it might also help figure out if having it = as >> a function would be beneficial/useful and whether the detail about >> which non-nil value is returned is important and whether supporting >> more than 2 args is important. I see little point in having xor but not equiv, but agree with this = argument. Hydrazine on the fire: `implies' is occasionally useful, especially in = assertions. (Dijkstra would have liked it.) --Apple-Mail=_5377160B-2DAF-4766-8929-26E6D7660573 Content-Disposition: attachment; filename=xor-equiv.log Content-Type: application/octet-stream; x-unix-mode=0644; name="xor-equiv.log" Content-Transfer-Encoding: 7bit ;; -*- compilation -*- lisp/calc/calc-aent.el:806:35: boolean xor (eq-not) lisp/calc/calc-alg.el:291:15: boolean equivalence (eq-not-not) lisp/calc/calc-rewr.el:265:11: boolean xor (eq-not) lisp/calc/calcalg2.el:3197:41: boolean xor (if-not) lisp/calc/calcsel2.el:260:22: boolean xor (eq-not) lisp/emacs-lisp/cl-seq.el:92:14: boolean xor (eq-not) lisp/emacs-lisp/cl-seq.el:94:12: boolean xor (eq-not) lisp/emacs-lisp/cl-seq.el:105:8: boolean xor (eq-not) lisp/emacs-lisp/edebug.el:460:27: boolean equivalence (eq-not-not) lisp/emacs-lisp/edebug.el:464:34: boolean xor (eq-not) lisp/emacs-lisp/ert.el:492:19: boolean equivalence (eq-not-not) lisp/eshell/em-ls.el:662:16: boolean xor (if-not) lisp/gnus/gnus-group.el:1301:16: boolean xor (if-not) lisp/gnus/gnus-sum.el:8471:19: boolean equivalence (if-not) lisp/gnus/gnus-sum.el:8564:17: boolean xor (or-and-not-and-not) lisp/gnus/gnus-sum.el:9111:11: boolean xor (if-not) lisp/gnus/message.el:2296:15: boolean xor (or-and-not-and-not) lisp/gnus/message.el:2385:34: boolean xor (or-and-not-and-not) lisp/gnus/message.el:8201:5: boolean xor (if-not) lisp/gnus/nnmail.el:1466:15: boolean xor (if-not) lisp/mail/sendmail.el:1902:7: boolean xor (or-and-not-and-not) lisp/net/browse-url.el:844:25: boolean xor (if-not) lisp/net/eudc.el:875:17: boolean xor (or-and-not-and-not) lisp/org/org.el:10073:3: boolean xor (if-not) lisp/progmodes/cc-engine.el:10072:31: boolean equivalence (eq-not-not) lisp/progmodes/cc-guess.el:504:25: boolean equivalence (or-and-not-or) lisp/progmodes/cpp.el:329:26: boolean xor (eq-not) lisp/progmodes/tcl.el:1348:20: boolean xor (if-not) lisp/progmodes/tcl.el:1361:22: boolean xor (if-not) lisp/progmodes/vhdl-mode.el:14421:17: boolean equivalence (or-and-and-not-not) lisp/textmodes/bibtex.el:4107:22: boolean xor (if-not) lisp/textmodes/bibtex.el:5284:10: boolean xor (if-not) lisp/textmodes/rst.el:2021:18: boolean equivalence (or-and-and-not-not) lisp/vc/cvs-status.el:452:29: boolean xor (if-not) lisp/vc/ediff-util.el:2550:4: boolean xor (if-not) lisp/vc/pcvs.el:1351:18: boolean xor (if-not) lisp/vc/vc-bzr.el:286:34: boolean equivalence (if-not) lisp/vc/vc-cvs.el:817:29: boolean equivalence (if-not) lisp/array.el:679:9: boolean equivalence (or-and-and-not-not) lisp/ffap.el:1548:12: boolean xor (if-not) lisp/ffap.el:1924:12: boolean xor (if-not) lisp/find-file.el:823:7: boolean xor (or-and-not-and-not) lisp/forms.el:1777:9: boolean equivalence (or-and-and-not-not) lisp/isearch.el:2662:29: boolean equivalence (eq-not-not) lisp/locate.el:256:7: boolean xor (or-and-not-and-not) lisp/locate.el:312:11: boolean xor (or-and-not-and-not) lisp/ls-lisp.el:705:11: boolean equivalence (eq-not-not) lisp/mouse.el:2596:15: boolean equivalence (if-not) lisp/pcmpl-gnu.el:69:11: boolean equivalence (or-and-and-not-not) lisp/pcmpl-gnu.el:94:11: boolean equivalence (or-and-and-not-not) lisp/ps-print.el:5355:17: boolean xor (if-not) test/src/regex-emacs-tests.el:177:9: boolean equivalence (or-and-not-or) --Apple-Mail=_5377160B-2DAF-4766-8929-26E6D7660573--