From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: Always using let* Date: Sun, 14 Sep 2014 23:41:49 +0200 Organization: Aioe.org NNTP Server Message-ID: <87d2axg9r6.fsf@debian.uxu> References: <87fvfukmso.fsf@Equus.decebal.nl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1410731130 8933 80.91.229.3 (14 Sep 2014 21:45:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 14 Sep 2014 21:45:30 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Sep 14 23:45:23 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 1XTHbn-0005uX-Ix for geh-help-gnu-emacs@m.gmane.org; Sun, 14 Sep 2014 23:45:23 +0200 Original-Received: from localhost ([::1]:56321 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTHbn-0000Co-7w for geh-help-gnu-emacs@m.gmane.org; Sun, 14 Sep 2014 17:45:23 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!aioe.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 43 Original-NNTP-Posting-Host: P0uMB9BthHuWo8+BJXB4Mw.user.speranza.aioe.org Original-X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-Notice: Filtered by postfilter v. 0.8.2 Cancel-Lock: sha1:PTRxsvarVepOhkjA02eoDyos1Vg= Mail-Copies-To: never Original-Xref: usenet.stanford.edu gnu.emacs.help:207614 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:99887 Archived-At: Drew Adams writes: >> Would it be OK to always use let*? I was just bitten >> by the fact that with let you can not previous >> variables from the let statement, as is possible >> with setq. So I am thinking about always using let*, >> so I do not have to think about it. Or are there >> good reasons to use let when you do not need let*? > > The most common reason is when you want to use a > variable value in the cadr of a binding and you do > *not* want to pick up the variable's newly bound > value. IOW, precisely the opposite use case of what > you wanted when you were bit. > > (setq c 3) > > (let ((c (+ c 4)) (b (* c 42))) Correct, but isn't that only confusing style? Isn't it better to call the c in the let something else? The only reason I don't always use let* is that it is slower type, looks awkward, and that other people reading the code will wonder: "why `let*'? there is nothing reoccurring!" > (The other reason is that for some Lisps the bindings > of `let' can be done in parallel, which can be > quicker.) Oh yeah?! Like parallel on a multicore computer? I only have single CPU so I can't test but that would be downright awesome. However let* could also in part run in parallel for the clauses that don't have precedence constraints (i.e., for wich the let* isn't necessary). -- underground experts united