[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: nameref and referenced variable scope, setting other attributes (was
From: |
Mike Jonkmans |
Subject: |
Re: nameref and referenced variable scope, setting other attributes (was "local -g" declaration references local var in enclosing scope) |
Date: |
Tue, 19 Mar 2024 16:50:04 +0100 |
On Mon, Mar 18, 2024 at 04:19:55PM -0400, Chet Ramey wrote:
> On 3/14/24 8:57 PM, Zachary Santer wrote:
> > On Thu, Mar 14, 2024 at 3:43 PM Chet Ramey <chet.ramey@case.edu> wrote:
> > >
> > > In fact, before 2020, local -p with no name arguments behaved the same as
> > > local without arguments, which just printed all the local variable names
> > > at
> > > the current scope in the form of assignment statements. That was certainly
> > > not usable to reproduce the current state.
> >
> > While we're kind of on the subject, I find it really odd that the
> > ${var@A} parameter expansion will expand to either an assignment
> > statement or a 'declare' command, depending on whether or not the
> > variable has an attribute set.
>
> Yes. There is one thing missing: the transformation should expand to a
> `declare' command when applied to a local variable at the current scope,
> even if there are no attributes to be displayed. Agreed?
>
> I am less convinced about outputting a `-g' for a global variable when
> called from a function scope, but I could be persuaded.
This would be logical.
Forgot the use case, but it was about a year ago that I needed this.
--
Regards, Mike Jonkmans
- Re: ${var@A}; hypothetical, related parameter transformations, (continued)
- Re: ${var@A}; hypothetical, related parameter transformations, Zachary Santer, 2024/03/18
- Re: ${var@A}; hypothetical, related parameter transformations, Zachary Santer, 2024/03/19
- Re: ${var@A}; hypothetical, related parameter transformations, Chet Ramey, 2024/03/20
- Re: ${var@A}; hypothetical, related parameter transformations, Zachary Santer, 2024/03/20
- Re: ${var@A}; hypothetical, related parameter transformations, Greg Wooledge, 2024/03/20
- Re: ${var@A}; hypothetical, related parameter transformations, alex xmb sw ratchev, 2024/03/20
- Re: ${var@A}; hypothetical, related parameter transformations, Zachary Santer, 2024/03/20
- Re: ${var@A}; hypothetical, related parameter transformations, Chet Ramey, 2024/03/21
- Re: ${var@A}; hypothetical, related parameter transformations, Chet Ramey, 2024/03/21
- Re: ${var@A}; hypothetical, related parameter transformations, Zachary Santer, 2024/03/24
- Re: nameref and referenced variable scope, setting other attributes (was "local -g" declaration references local var in enclosing scope),
Mike Jonkmans <=
- Re: nameref and referenced variable scope, setting other attributes (was "local -g" declaration references local var in enclosing scope), Chet Ramey, 2024/03/19
- Re: nameref and referenced variable scope, setting other attributes (was "local -g" declaration references local var in enclosing scope), Mike Jonkmans, 2024/03/19
- Re: "local -g" declaration references local var in enclosing scope, Chet Ramey, 2024/03/11
Re: "local -g" declaration references local var in enclosing scope, Lawrence Velázquez, 2024/03/10
Re: "local -g" declaration references local var in enclosing scope, Kerin Millar, 2024/03/11
Re: "local -g" declaration references local var in enclosing scope, Kerin Millar, 2024/03/11
Re: "local -g" declaration references local var in enclosing scope, Adrian Ho, 2024/03/11