Re: static vs. dynamic scoping

2010-11-11 Thread Marc Herbert
>> Examples? >> >> http://fvue.nl/wiki/Bash:_Passing_variables_by_reference , I like that. > Very interesting. This reminds me of reflection in Java. Something difficult and dangerous to use, so you never use it directly. Instead you ask a framework or a library ( ~= "upvar" ) to use reflection f

Re: static vs. dynamic scoping

2010-11-10 Thread Clark J. Wang
On Wed, Nov 10, 2010 at 6:37 PM, Marc Herbert wrote: > Chris F.A. Johnson: > > I find the bash behaviour more logical, and I do use it in scripts. > > Examples? > > http://fvue.nl/wiki/Bash:_Passing_variables_by_reference , I like that.

Re: static vs. dynamic scoping

2010-11-10 Thread Marc Herbert
Eric Blake: > On the Austin Group mailing list, David Korn (of ksh93 fame) > complained[1] that bash's 'local' uses dynamic scoping, but that ksh's > 'typeset' uses static scoping, and argued that static scoping is saner > since it matches the behavior of declarative languages like C and Java > (dy

Re: static vs. dynamic scoping

2010-11-09 Thread Jan Schampera
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 kno

Re: static vs. dynamic scoping

2010-11-09 Thread Chet Ramey
On 11/9/10 4:52 PM, Eric Blake wrote: > On the Austin Group mailing list, David Korn (of ksh93 fame) > complained[1] that bash's 'local' uses dynamic scoping, but that ksh's > 'typeset' uses static scoping, and argued that static scoping is saner > since it matches the behavior of declarative langu

Re: static vs. dynamic scoping

2010-11-09 Thread Chris F.A. Johnson
On Tue, 9 Nov 2010, Eric Blake wrote: On the Austin Group mailing list, David Korn (of ksh93 fame) complained[1] that bash's 'local' uses dynamic scoping, but that ksh's 'typeset' uses static scoping, and argued that static scoping is saner since it matches the behavior of declarative languages