From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thorsten Jolitz Newsgroups: gmane.emacs.help Subject: Emacs Lisp coding style question Date: Wed, 02 Jul 2014 14:47:46 +0200 Message-ID: <87oax8x6z1.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1404305322 7997 80.91.229.3 (2 Jul 2014 12:48:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 2 Jul 2014 12:48:42 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 02 14:48:35 2014 Return-path: Envelope-to: geh-help-gnu-emacs@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 1X2Jxi-00015X-V8 for geh-help-gnu-emacs@m.gmane.org; Wed, 02 Jul 2014 14:48:35 +0200 Original-Received: from localhost ([::1]:52936 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2Jxi-0001g4-LA for geh-help-gnu-emacs@m.gmane.org; Wed, 02 Jul 2014 08:48:34 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2JxJ-0001P3-68 for help-gnu-emacs@gnu.org; Wed, 02 Jul 2014 08:48:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X2JxB-0006sf-IF for help-gnu-emacs@gnu.org; Wed, 02 Jul 2014 08:48:08 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:48547) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2JxB-0006sC-CO for help-gnu-emacs@gnu.org; Wed, 02 Jul 2014 08:48:01 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1X2Jx9-0000ea-Oi for help-gnu-emacs@gnu.org; Wed, 02 Jul 2014 14:47:59 +0200 Original-Received: from g231109238.adsl.alicedsl.de ([92.231.109.238]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 02 Jul 2014 14:47:59 +0200 Original-Received: from tjolitz by g231109238.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 02 Jul 2014 14:47:59 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 49 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: g231109238.adsl.alicedsl.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:VsJPzONF+hjvcqR3yokp5UOrI8Y= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:98500 Archived-At: Hi List, sometimes I wondered about the following coding style question, so I decided to do it in public: Often functions do a lot of work to gather some data and then do a rather simple action with the gathered data: #+begin_src emacs-lisp (defun foo () (let* ((x (create-x)) (y (create-y)) (z (create-z x y)) (u (create-u z)) (v (create-v)) (w (create-w u v))) (simple-action w))) #+end_src Thats the way I would do it, and I find it easy to write, read and understand. But (without being able to give concrete examples right now) I noticed that advanced Lispers tend to call this 'C-style', consider the let bindings unnessesary since the local vars are only used once, and prefer this style: #+begin_src emacs-lisp (defun foo () (simple-action (create-w (create-u (create-z (create-x) (create-y))) (create-v)))) #+end_src This looks more 'lispy' and might have a slight performance advantage. But when the 'create-xyz' expressions grow in size the whole thing might start to look very complicated and it becomes hard to recognize that its just about `simple-action' with some gathered data. What would be the recommended style for Emacs Lisp, or is this just a matter of taste? -- cheers, Thorsten