[Top][All Lists]

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

Re: about the local not-on-every-function-separately var issue

From: Alex fxmbsw7 Ratchev
Subject: Re: about the local not-on-every-function-separately var issue
Date: Mon, 22 Mar 2021 10:00:41 +0100

im sorry to not be able to reply to all your stuffs
you didnt make it easy
im happy it works for me now

On Mon, Mar 22, 2021 at 3:43 AM Greg Wooledge <greg@wooledge.org> wrote:
> On Mon, Mar 22, 2021 at 03:12:25AM +0100, Alex fxmbsw7 Ratchev wrote:
> > i realize its somewhat of a big limitation, to have only global and
> > one level further ( local ) args, no per function
> One or more of your assumptions are wrong.
> Bash uses "dynamic scope" when it expands variables.  This means that
> it looks first in the current functions local variables; if the variable
> isn't found there, it looks in the caller's local variables, and then
> in the caller's caller's local variables, and so on, until it reaches
> the global scope.
> f() {
>   local var=set_in_f
>   g
> }
> g() {
>   echo "var is $var"
> }
> var=global
> f
> # Prints "var is set_in_f"
> Now, the big question is WHY you thought something which is not correct.
> The most common reasons that people think something which is wrong are:
> 1) They heard or read it somewhere, and did not verify it themselves.
> 2) They encountered a problem with their own program, and while attempting
>    to track down the problem, they took a wrong turn, and did not fully
>    diagnose the situation.  They drew a wrong conclusion from partial data.
> In your case, I suspect it's #2.
> This project that you've been working on is so incredibly arcane,
> convoluted and bizarre that *nobody* understands it, including you.  Who
> knows how many other fallacious assumptions are baked into it, since you
> are apparently incapable of simplifying anything down to the most basic
> level for debugging, or even explaining what your *goal* is.

reply via email to

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