unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Magne Ingebrigtsen <larsi@gnus.org>
To: emacs-devel@gnu.org
Subject: Re: Lexical let and setq
Date: Sat, 14 Sep 2013 13:13:32 +0200	[thread overview]
Message-ID: <m3fvt71wrn.fsf@stories.gnus.org> (raw)
In-Reply-To: jwvk3ikm5nm.fsf-monnier+emacs@gnu.org

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> That one is OK, since recursion is not supported efficiently.
> The problem is when people use the above because they're writing (poor)
> C code in Elisp (e.g. they begin their functions with a big let
> declaring all the local vars that they may use later on in the
> function).

I think the most common reason for stashing a lot of variables in a let
is to avoid infinite indentation.

(let ((a (foo)))
  (something)
  (let ((b (something-else)))
    (more a b)
    (let ((c (yet-more)))
      (zot a b c))))

vs

(let ((a (foo))
      b c)
  (something)
  (setq b (something-else))
  (more a b)
  (setq c (yet-more))
  (zot a b c))

I kinda think the latter form is sometimes more readable.  

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen




  reply	other threads:[~2013-09-14 11:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <871u51ll93.fsf@yandex.ru>
     [not found] ` <jwvzjrly386.fsf-monnier+emacs@gnu.org>
     [not found]   ` <jwvhadps8a1.fsf-monnier+emacs@gnu.org>
     [not found]     ` <0b29ebee-8ed4-47e2-816b-910a013a0898@default>
     [not found]       ` <jwvzjrhqrft.fsf-monnier+emacs@gnu.org>
2013-09-14  0:09         ` Lexical let and setq Michael Welsh Duggan
2013-09-14  3:46           ` Stefan Monnier
2013-09-14 11:13             ` Lars Magne Ingebrigtsen [this message]
2013-09-14 14:04               ` Pascal J. Bourguignon
2013-09-15  5:11               ` Stefan Monnier
2013-09-14 21:47           ` Richard Stallman
2013-09-15  5:09             ` Stefan Monnier
2013-09-15 16:54               ` Richard Stallman
2013-09-15 17:06                 ` Stefan Monnier
2013-09-16 10:47                   ` Richard Stallman
2013-09-16 15:59 Barry OReilly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3fvt71wrn.fsf@stories.gnus.org \
    --to=larsi@gnus.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).