[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: nameref and referenced variable scope, setting other attributes (was
From: |
Zachary Santer |
Subject: |
Re: nameref and referenced variable scope, setting other attributes (was "local -g" declaration references local var in enclosing scope) |
Date: |
Thu, 14 Mar 2024 08:29:47 -0400 |
On Wed, Mar 13, 2024 at 3:44 PM Chet Ramey <chet.ramey@case.edu> wrote:
>
> `local' always creates variables at the current scope, or at the global
> scope if `-g' is supplied. If it's supplied the name of a nameref, it first
> resolves the nameref to find the name of the variable it's supposed to act
> on, failing if it can't. Once it has the name it needs, it creates or
> modifies the variable at the current scope. It doesn't try to create or
> modify the variable at the nameref's scope. This is one consequence of
> dynamic scoping that affects the implementation: a nameref's value is just
> a name, not a pointer to a specific instance of a variable. Once you have
> that name, the normal scoping rules apply.
>
> If you want to look at it from a filesystem perspective, a nameref is a
> symlink, rather than a hard link.
Alright, that's all fair. But this?
On Sun, Mar 10, 2024 at 7:29 PM Zachary Santer <zsanter@gmail.com> wrote:
>
> Additionally, a nameref variable referencing a variable declared in a calling
> function hides that variable in the scope of the function where the nameref
> variable is declared.
- "local -g" declaration references local var in enclosing scope, Adrian Ho, 2024/03/10
- Re: "local -g" declaration references local var in enclosing scope, Kerin Millar, 2024/03/10
- Re: "local -g" declaration references local var in enclosing scope, Zachary Santer, 2024/03/10
- nameref and referenced variable scope, setting other attributes (was "local -g" declaration references local var in enclosing scope), Zachary Santer, 2024/03/10
- Re: nameref and referenced variable scope, setting other attributes (was "local -g" declaration references local var in enclosing scope), Chet Ramey, 2024/03/13
- Re: nameref and referenced variable scope, setting other attributes (was "local -g" declaration references local var in enclosing scope), alex xmb sw ratchev, 2024/03/14
- Re: nameref and referenced variable scope, setting other attributes (was "local -g" declaration references local var in enclosing scope), Greg Wooledge, 2024/03/14
- Re: nameref and referenced variable scope, setting other attributes (was "local -g" declaration references local var in enclosing scope), alex xmb sw ratchev, 2024/03/14
- Re: nameref and referenced variable scope, setting other attributes (was "local -g" declaration references local var in enclosing scope),
Zachary Santer <=
- Re: nameref and referenced variable scope, setting other attributes (was "local -g" declaration references local var in enclosing scope), Greg Wooledge, 2024/03/14
- Re: nameref and referenced variable scope, setting other attributes (was "local -g" declaration references local var in enclosing scope), Zachary Santer, 2024/03/14
- Re: nameref and referenced variable scope, setting other attributes (was "local -g" declaration references local var in enclosing scope), Greg Wooledge, 2024/03/14
- Re: nameref and referenced variable scope, setting other attributes (was "local -g" declaration references local var in enclosing scope), Zachary Santer, 2024/03/14
- Re: nameref and referenced variable scope, setting other attributes (was "local -g" declaration references local var in enclosing scope), Chet Ramey, 2024/03/14
- Re: nameref and referenced variable scope, setting other attributes (was "local -g" declaration references local var in enclosing scope), alex xmb sw ratchev, 2024/03/14
- Re: nameref and referenced variable scope, setting other attributes (was "local -g" declaration references local var in enclosing scope), Robert Elz, 2024/03/14
- Re: nameref and referenced variable scope, setting other attributes (was "local -g" declaration references local var in enclosing scope), Chet Ramey, 2024/03/14
- Re: nameref and referenced variable scope, setting other attributes (was "local -g" declaration references local var in enclosing scope), Zachary Santer, 2024/03/14
- Re: nameref and referenced variable scope, setting other attributes (was "local -g" declaration references local var in enclosing scope), Zachary Santer, 2024/03/14