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

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

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


From: Stefan Monnier
Subject: Re: [External] : Re: Lexical vs. dynamic: small examples?
Date: Sun, 15 Aug 2021 17:55:49 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> "Dynamic" is something that changes over time, but TBH I don't
> really see the static/dynamic aspect or difference here?

This use of the term is the same as used in code analysis.
"static" refers to the fact that you can find the definition
corresponding to a particular use by just looking at the code without
having "run" it.

In contrast "dynamic" refers to the fact that in order to find which
definition corresponds to a particular use can only be done you need to
run the code (or simulate a run, typically in your head).

It can also be considered from the following point of view: with
lexical/static scoping, a given variable reference will always refer to
the same definition point, i.e. the "use-to-def" doesn't change and is
hence "static", whereas with dynamic scoping, a given variable reference
can refer to various definitions at different moments of a program
execution, i.e. the "use-to-def" can change and is hence dynamic.


        Stefan




reply via email to

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