unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg <incal@dataswamp.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Lions & tigers & variables - Oh my! [was: Lisp error on function :documentation]
Date: Wed, 19 Oct 2022 07:16:11 +0200	[thread overview]
Message-ID: <877d0wbdgk.fsf@dataswamp.org> (raw)
In-Reply-To: SJ0PR10MB5488AA2F20F919FE8F17372FF3289@SJ0PR10MB5488.namprd10.prod.outlook.com

Drew Adams wrote:

> Yes, all of that is OT. What's not OT is that for Emacs
> users, _in particular_, special (global) vars can be
> quite useful.
>
> Precisely _because_ they can let you reach across existing
> code without modifying it [...]

But then that existing code has to use that variable. So for
the dynamic/special _and_ global variables to be useful, they
have to actually be used ;)

Let's take it from another side, I just asked what you can do
with lexical/static variables in `let'-closures, and answered
you can share them between two or several `defun', and you can
use them to keep persistent/state data between calls
to functions.

I don't know if that's a good answer in the sense that it is
complete but I know it is a good answer in the sense that it
is true because I have used let-closures exactly like that.

So we know they can do that, and global variables obviously
also can, but can global variables do something else that
they cannot?

That they can be accessed from anywhere?

So when you want that, that's when you should use them? Okay,
but then when typically do you want that? When what they
describe is so general it is just so likely that a lot of
stuff, including future stuff, will use them, so it is just
impractical to put them in a closure?

Actually in a way the whole global closure is just one big
closure for global variables I guess. It's the top-level
closure since there is nothing outside of it ...

-- 
underground experts united
https://dataswamp.org/~incal




  parent reply	other threads:[~2022-10-19  5:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18 15:37 Lions & tigers & variables - Oh my! [was: Lisp error on function :documentation] Drew Adams
2022-10-18 23:25 ` Emanuel Berg
2022-10-19 14:09   ` [External] : " Drew Adams
2022-10-19 20:20     ` Emanuel Berg
2022-10-20  8:48       ` tomas
2022-10-21  3:37         ` Emanuel Berg
2022-10-21  8:40         ` Emanuel Berg
2022-10-19  5:16 ` Emanuel Berg [this message]
2022-10-19  5:27 ` 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=877d0wbdgk.fsf@dataswamp.org \
    --to=incal@dataswamp.org \
    --cc=help-gnu-emacs@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.
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).