[Top][All Lists]

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

Re: static vs. dynamic scoping

From: Jan Schampera
Subject: Re: static vs. dynamic scoping
Date: Wed, 10 Nov 2010 06:44:27 +0100
User-agent: Mozilla-Thunderbird (X11/20100329)

Eric Blake wrote:

In static scoping, function f2 does not shadow a declaration of a, so
references to $a within f2 refer to the global variable.  The local
variable a of f1 can only be accessed within f1; the behavior of f2 is
the same no matter how it was reached.

If it matters (I already know Chet's answer): I agree with Mr. Korn here about sanity. Infact, for some reason, I always intuitively relied on it (without any problem for now - I didn't hit a case), maybe I intuitively expected the C behaviour from Bash.

In Bash practise, now as I know it, I can code accordingly.

Be conservative in what you do, be liberal in what you accept from others.
- jbp, master of the net, in RFC793

reply via email to

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