From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.help Subject: Re: let, let*, oh, why [was: Elisp - Function returning a list] Date: Wed, 16 Dec 2020 18:10:29 +0300 Message-ID: References: <87k0ti9ygy.fsf@zoho.eu> <87czza8g37.fsf@zoho.eu> <20201216115242.GB11162@tuxteam.de> <87sg85u9dq.fsf@zoho.eu> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39787"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/2.0 (3d08634) (2020-11-07) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 16 16:17:16 2020 Return-path: Envelope-to: geh-help-gnu-emacs@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 1kpYYF-000AEl-Tr for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 16 Dec 2020 16:17:15 +0100 Original-Received: from localhost ([::1]:37190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpYYE-0000pB-Ts for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 16 Dec 2020 10:17:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37540) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpYWR-0000l0-Pt for help-gnu-emacs@gnu.org; Wed, 16 Dec 2020 10:15:23 -0500 Original-Received: from stw1.rcdrun.com ([217.170.207.13]:35797) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpYWM-0003Vk-JV for help-gnu-emacs@gnu.org; Wed, 16 Dec 2020 10:15:20 -0500 Original-Received: from localhost ([::ffff:197.157.0.58]) (AUTH: PLAIN securesender, TLS: TLS1.2,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by stw1.rcdrun.com with ESMTPSA id 000000000001E6E8.000000005FDA2483.00005DE6; Wed, 16 Dec 2020 08:15:15 -0700 Content-Disposition: inline In-Reply-To: <87sg85u9dq.fsf@zoho.eu> Received-SPF: pass client-ip=217.170.207.13; envelope-from=bugs@gnu.support; helo=stw1.rcdrun.com X-Spam_score_int: 29 X-Spam_score: 2.9 X-Spam_bar: ++ X-Spam_report: (2.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_SBL_CSS=3.335, RCVD_IN_SORBS_WEB=1.5, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:126423 Archived-At: * Emanuel Berg via Users list for the GNU Emacs text editor [2020-12-16 17:34]: > tomas wrote: > > > What "upwards" means depends on whether you are under > > dynamic scope (traditional) or lexical scope (more modern, > > recommended almost always). > > Indeed, put this topmost in your Elisp files: > > ;;; -*- lexical-binding: t -*- That line is somehow out of sight for me so I just use: (setq lexical-binding t) as first line in the file. > Then use `let' and `let*'. > > Write code as one intuitively does, based on functions that do > stuff and/or return stuff. > > When done, byte compile. > > Simple simple simple. Actually it is much easier to do right > than to do wrong in this case. I do follow that workflow as you explained, but it took me time to find out about it. I do not find it all simple as workflows like that are not described anywhere. Functions are described in the manual and everything is there but general practical workflows are not there. In other words instructions are not well integrated. Environments like Dr. Racket also try to be self-documented. I still find Emacs better self-documented than other similar environments. There are no big deals with dynamic variables as well, one can program for years without real problem. Then if programmer knows the problem one can continue programming for decades without entering into problem. > But the byte-compiler will: > > In test-var: > geh.el:210:11: Warning: assignment to free variable ‘some-vari’ Good to have such messages.