From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?utf-8?Q?=C3=93scar_Fuentes?= Newsgroups: gmane.emacs.devel Subject: Re: Wierd Elispsisms Date: Mon, 12 Aug 2013 00:33:45 +0200 Message-ID: <87eh9zn9h2.fsf@wanadoo.es> References: <87iozcmq93.fsf@wanadoo.es> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1376260455 8294 80.91.229.3 (11 Aug 2013 22:34:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 11 Aug 2013 22:34:15 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 12 00:34:16 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V8eDI-0000pd-EE for ged-emacs-devel@m.gmane.org; Mon, 12 Aug 2013 00:34:16 +0200 Original-Received: from localhost ([::1]:53897 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V8eDI-0002W6-2G for ged-emacs-devel@m.gmane.org; Sun, 11 Aug 2013 18:34:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V8eD8-0002Vs-DT for emacs-devel@gnu.org; Sun, 11 Aug 2013 18:34:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V8eD2-0000Xu-7N for emacs-devel@gnu.org; Sun, 11 Aug 2013 18:34:06 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:41637) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V8eD2-0000Vq-0j for emacs-devel@gnu.org; Sun, 11 Aug 2013 18:34:00 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1V8eD0-0000Wk-6m for emacs-devel@gnu.org; Mon, 12 Aug 2013 00:33:58 +0200 Original-Received: from 137.red-83-61-144.dynamicip.rima-tde.net ([83.61.144.137]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 12 Aug 2013 00:33:58 +0200 Original-Received: from ofv by 137.red-83-61-144.dynamicip.rima-tde.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 12 Aug 2013 00:33:58 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 44 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 137.red-83-61-144.dynamicip.rima-tde.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Cancel-Lock: sha1:tlzV6Orlvvw7RtdK1qmCZ5RKv1w= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:162591 Archived-At: Juanma Barranquero writes: > On Sun, Aug 11, 2013 at 1:16 PM, Óscar Fuentes wrote: > >> look bizarre. As someone who is not strong on Elisp, I was puzzled at >> first. Finally realized that the point is to force a boolean value for >> `compressed'. > > Both expressions are common enough. Grepping for "(not (not " on .el files under lisp/ shows 11 occurrences. Detecting "(and ... t) is harder, so didn't tried. However, if casting a value to a boolean is a common task, that's a strong reason for delegating the job to a function. >> And, if there exists a reason for using nil/t instead of the original >> value here and elsewhere, why doesn't exist a function for casting an >> arbitrary value to a boolean? > > Generally speaking, I'd say (not (not X)) or (and X t) can be > optimized and a funcall not. I guess that the byte-compiler could apply the same optimization to a defsubst. > But anyway, I suspect the answer is, why > use a function when you have a simple idiom every lisp programmer will > understand and have quite internalized? To me, what you're asking is > as if you objected to the common use of (or x y) instead of (if x x > y). Idioms. As already mentioned, they don't look simple to me, but I'm not a Lisp programmer (neither are most Emacs users who at some point try to hack some Elisp). About the idioms, C allows lots of things which are quite "obvious" to the eyes of the expert C hacker and for a long time writing C code on a certain "clever" (read "compressed & mind twisting") way was considered the hallmark of the expert, but nowadays those idioms are often discouraged, as they make the code hard to read and maintain. We could say the same about most languages, with some extreme cases (Perl) All this is IMHO, no big issue, I just was curious. Thanks for explaining Juanma.