help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FW: [External] : Re: Lexical vs. dynamic: small examples?


From: Drew Adams
Subject: FW: [External] : Re: Lexical vs. dynamic: small examples?
Date: Thu, 26 Aug 2021 17:01:27 +0000

> So the way it should be done is:
> 
> Put ;;; -*- lexical-binding: t -*- in the beginning of
> the file.
> 
> Use `defvar' and `setq' for global variables that then become
> special/dynamic.
> 
> Use `let' for local variables that then become lexical/static
> (because of `lexical-binding').

Except `let' binds dynamically bound (aka "special")
vars dynamically.  E.g., if you have a (defvar foo)
declaration then a subsequent (let ((foo ...))...)
binds `foo' dynamically.

> And nothing unexpected ever happens, because for the global,
> special/dynamic variables one uses prefixes?

Does one?  Maybe.  But how do you think a
prefix in the name changes something wrt
the kind of binding?

<<attachment: winmail.dat>>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]