unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: curious why private variables are rare
Date: Sat, 19 Nov 2022 22:53:47 -0500	[thread overview]
Message-ID: <jwvedty5lpt.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: CAJcAo8tsy-pFFZ2L2FTO=P71NVsPKDX20KmXnzgO5GdVf9O44A@mail.gmail.com

> even when var is only used by fun.  but you could do:
>
>   (let ((var ...))
>     (defun fun ...))

Indeed.

> so I am just curious why the usual thing is usual.  is it the above
> reasons?  or am i missing some bigger things?

Most likely it's because it started working quite late in the history of
ELisp, so habits were taken at a stage where it wasn't an option.

Side note: the above works, but the compiler doesn't understand it well
enough, which leads to some minor/invisible effects (the .elc file is
marginally less efficient) and some less invisible effects (code after
that `let` will get spurious warnings (about a call to unknown function)
if it calls `fun`) :-(


        Stefan




  reply	other threads:[~2022-11-20  3:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-20  2:07 curious why private variables are rare Samuel Wales
2022-11-20  3:53 ` Stefan Monnier via Users list for the GNU Emacs text editor [this message]
2022-11-21 12:52   ` Emanuel Berg
2023-10-02 23:56     ` Samuel Wales
2022-11-21 12:48 ` Emanuel Berg

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=jwvedty5lpt.fsf-monnier+emacs@gnu.org \
    --to=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.
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).