From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Emanuel Berg via "Emacs development discussions." Newsgroups: gmane.emacs.devel Subject: Re: defvar without value Date: Sat, 11 Apr 2020 01:07:02 +0200 Message-ID: <878sj3kkix.fsf@ebih.ebihd> References: <87k1302htp.fsf@web.de> <878sjebzaj.fsf@web.de> <875ze94e9c.fsf@web.de> <87blo0mdwi.fsf@ebih.ebihd> <877dyngyep.fsf@oitofelix.com> Reply-To: Emanuel Berg Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="118107"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) To: emacs-devel@gnu.org Cancel-Lock: sha1:LPEvSVfxwZJnBbY8TZmsVrDGYoM= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Apr 11 01:07:46 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jN2kU-000Uf5-Ll for ged-emacs-devel@m.gmane-mx.org; Sat, 11 Apr 2020 01:07:46 +0200 Original-Received: from localhost ([::1]:39802 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jN2kT-0007ML-Oj for ged-emacs-devel@m.gmane-mx.org; Fri, 10 Apr 2020 19:07:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54042) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jN2ju-0006i9-Ru for emacs-devel@gnu.org; Fri, 10 Apr 2020 19:07:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jN2jt-0002YM-KP for emacs-devel@gnu.org; Fri, 10 Apr 2020 19:07:10 -0400 Original-Received: from ciao.gmane.io ([159.69.161.202]:51190) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jN2jt-0002Xz-Ep for emacs-devel@gnu.org; Fri, 10 Apr 2020 19:07:09 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1jN2js-000U5s-5a for emacs-devel@gnu.org; Sat, 11 Apr 2020 01:07:08 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Mail-Copies-To: never X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 159.69.161.202 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:246810 Archived-At: Bruno Félix Rezende Ribeiro wrote: >> The supposedly parallel version isn't needed in my >> experience if there is `let*' [...] Maybe `let' will >> truly be parallel one day [...] > > That’s not the only use of ‘let’, because it’s not > a weaker form of ‘let*’ as one might first think. > Both are fundamentally different in their operation > and ‘let’ is indeed parallel in some strict > theoretical sense, in the same way ‘let*’ is > sequential in the same sense. Both forms coincide in > effect only in the trivial case: when there is no > reference to (textually) earlier variables being bound > in the subsequent forms being evaluated to obtain the > values to be bound to the later ones. OK, but then the trivial case is the sound one. Reusing names in `let' bindings is like asking for trouble. The only exception is when one temporarily wants to have the old variable another value in another, remote function. But then it should be super simple, just assign the new value and invoke the function, and snap back to normal. > For instance consider the difference between > > #+BEGIN_SRC elisp > (let ((x 0)) > (let ((x (1- x)) > (y (1+ x))) > (cons x y))) > #+END_SRC > > and > > #+BEGIN_SRC elisp > (let ((x 0)) > (let* ((x (1- x)) > (y (1+ x))) > (cons x y))) > #+END_SRC > > The former evaluates to ~(-1 . 1)~ while the latter to > ~(-1 . 0)~. Both are valid expressions with sensible > behavior and are not interchangeable. The answer to > which one to use does *not* follow from the criterion: > “are the variables to be bound interdependent?”, since > in both cases they are (and the behavior is > different). Well... IMO your example does not demonstrate one being parallel and one being sequential as much as it is a way of telling what x is refered to. And there is a better way to do that, namely calling the variables different things. And then: (let ((x 0)) (let ((a (1- x)) (y (1+ a)) ) (cons a y) )) ; DNC But: (let*((x 0) (a (1- x)) (y (1+ x)) ) (cons a y) ) ; (-1 . 1) -- underground experts united http://user.it.uu.se/~embe8573 https://dataswamp.org/~incal