[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [External] : Re: Lexical vs. dynamic: small examples?
From: |
Emanuel Berg |
Subject: |
Re: [External] : Re: Lexical vs. dynamic: small examples? |
Date: |
Sun, 15 Aug 2021 06:44:28 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Drew Adams wrote, somewhere else:
> If this is only about let "let's" have two lets, one
> "let-stay" and one "let-follow".
`let' is not the only construct that can define a
scope. For example, a function definition (a `defun'
or a lambda) defines the scope of its formal
parameters - they're lexically scoped.
Yes, and what happens is, the formal parameters are check
first, only after that are global variables checked!
But that is completely normal and 100% expected. If that is
"lexical scope", how would one do it in another way? (OK, it
_is_ lexical binding for the arguments and dynamic for the
globals but has this any practical implications?)
No, the only thing I've seen so far - maybe the only thing it
is? - is `let', and that acts in two ways, the lexical way if
one puts
;;; -*- lexical-binding: t -*-
first thing in the source file, and if one doesn't, it acts in
the dynamic way.
So I wonder again, why not just have two let, one "let-stay"
(the variables stay so has to be used and/or passed
explicitely), and "let-follow" (the variables follow
everywhere the code goes within the let form).
Then one could drop this whole discussion because everything
would work as expected and everyone could use whatever they
wanted and instead of explaining some scope vs another in
terms of theory one would have one docstring for "let-stay"
and one for "let-follow" and these would also not confuse
anything by engaging in a theoretical discussion but just
describe what the function does and what its purpose is.
?
--
underground experts united
https://dataswamp.org/~incal
- Re: Lexical vs. dynamic: small examples?, (continued)
Re: Lexical vs. dynamic: small examples?, tomas, 2021/08/14
RE: [External] : Re: Lexical vs. dynamic: small examples?, Drew Adams, 2021/08/14
- Re: [External] : Re: Lexical vs. dynamic: small examples?, Emanuel Berg, 2021/08/14
- Re: [External] : Re: Lexical vs. dynamic: small examples?, Emanuel Berg, 2021/08/14
- Re: [External] : Re: Lexical vs. dynamic: small examples?, Emanuel Berg, 2021/08/14
- Re: [External] : Re: Lexical vs. dynamic: small examples?,
Emanuel Berg <=
- Re: [External] : Re: Lexical vs. dynamic: small examples?, Emanuel Berg, 2021/08/15
- RE: [External] : Re: Lexical vs. dynamic: small examples?, Drew Adams, 2021/08/15
- Re: [External] : Re: Lexical vs. dynamic: small examples?, Emanuel Berg, 2021/08/15
- Re: [External] : Re: Lexical vs. dynamic: small examples?, Stefan Monnier, 2021/08/15
- Re: [External] : Re: Lexical vs. dynamic: small examples?, Emanuel Berg, 2021/08/15
RE: [External] : Re: Lexical vs. dynamic: small examples?, Drew Adams, 2021/08/15
Re: [External] : Re: Lexical vs. dynamic: small examples?, Emanuel Berg, 2021/08/15
RE: [External] : Re: Lexical vs. dynamic: small examples?, Drew Adams, 2021/08/15
RE: [External] : Re: Lexical vs. dynamic: small examples?, Drew Adams, 2021/08/15
Re: [External] : Re: Lexical vs. dynamic: small examples?, Arthur Miller, 2021/08/15