I see oft repeated that shells presently use the keyword `local` with varying 
semantics, as if anyone needed to be constantly reminded of this trivial fact.

So what? That is not a blocker. Arrive at a consensus on a useful lowest common 
denominator set of semantics for function scoped variables, and select a 
different keyword than `local`. I propose `let`.

Cheers,

Andrew
[email protected]

On Thursday, October 31st, 2024 at 11:58 PM, Christoph Anton Mitterer 
<[email protected]> wrote:

> On Fri, 2024-11-01 at 04:01 +0000, Andrew via austin-group-l at The
> Open Group wrote:
> 
> > What's the progress looking like for support of local, function
> > scoped variables in POSIX sh?
> 
> 
> There used to be a request[0] which as however rejected.
> 
> Given that different shells already implement `local` with different
> semantics, it seems unlikely this will ever get resolved (as that might
> break tons of code).
> 
> 
> Maybe the best chance would be if another special built-in / attribute
> would be implemented by shells, where all agree in advance on the exact
> semantics (while keeping their own `local`), but even that seems rather
> unlikely to me.
> 
> > Are subshells an effective workaround meanwhile?
> 
> 
> Depends probably on what one wants to do, but you couldn't change
> "global" variables from such functions (not outside the subshell)...
> and it's probably not very efficient (if that matters).
> 
> 
> Cheers,
> Chris.
> 
> 
> [0] https://austingroupbugs.net/view.php?id=767

  • status of lo... Andrew via austin-group-l at The Open Group
    • Re: sta... Lawrence Velázquez via austin-group-l at The Open Group
    • Re: sta... Christoph Anton Mitterer via austin-group-l at The Open Group
      • Re:... Andrew via austin-group-l at The Open Group
        • ... Lawrence Velázquez via austin-group-l at The Open Group
        • ... Stephane Chazelas via austin-group-l at The Open Group
          • ... Andrew via austin-group-l at The Open Group
          • ... Steffen Nurpmeso via austin-group-l at The Open Group
            • ... Stephane Chazelas via austin-group-l at The Open Group
              • ... Christoph Anton Mitterer via austin-group-l at The Open Group
                • ... David A. Wheeler via austin-group-l at The Open Group
                • ... Steffen Nurpmeso via austin-group-l at The Open Group
                • ... Stephane Chazelas via austin-group-l at The Open Group
                • ... Steffen Nurpmeso via austin-group-l at The Open Group

Reply via email to