Re: static vs. dynamic scoping

2010-11-13 Thread Harald van Dijk
On 14/11/10 00:54, ольга крыжановская wrote: Now function a uses typeset IFS="X" to set the field separator to "X" via a local variable IFS. If function b now uses "read foo1 foo2 foo3" to read a line of a database the concept of dynamic scoping *BITES*. The way I had seen "local IFS" used is t

Re: static vs. dynamic scoping

2010-11-13 Thread ольга крыжановская
How is dynamic scoping in this case 'more useful'? Imagine function a written by author A and function b written by author B, both loaded into an application and each of them working independently, bound together by an api spec. Now function a uses typeset IFS="X" to set the field separator to "X"

Re: static vs. dynamic scoping

2010-11-13 Thread Harald van Dijk
On 09/11/10 23:02, Eric Blake wrote: 2. User aspect: Is anyone aware of a script that intentionally uses the full power of dynamic scoping available through 'local' which would break if scoping switched to static? FWIW, some scripts use "local IFS" to reset IFS to a sane value, and have the

Re: dash "set -e" breaks "trap INT"

2010-11-13 Thread Jilles Tjoelker
On Wed, Nov 10, 2010 at 03:49:19PM +0200, Dan Muresan wrote: > I've submitted a bug regarding trap + "set -e" on Ubuntu Launchpad > [1], but that's probably not the best place to talk about the issue. > I'm using dash 0.5.5.1-3ubuntu2 from Ubuntu Lucid on an x86 machine. > With "set -e", only the

Re: Quoted closing brace in variable default expansion

2010-11-13 Thread Jilles Tjoelker
On Sat, Nov 13, 2010 at 10:41:47AM -0600, Jonathan Nieder wrote: > Harald van Dijk wrote: > > $ ksh -c 'echo "${x:-"}"}"' > > } > > $ dash -c 'echo "${x:-"}"}"' > > dash: 1: Syntax error: Unterminated quoted string > > $ busybox sh -c 'echo "${x:-"}"}"' > > sh: syntax error: unterminat

Re: Quoted closing brace in variable default expansion

2010-11-13 Thread Harald van Dijk
On 13/11/10 17:41, Jonathan Nieder wrote: Harald van Dijk wrote: $ dash -c 'echo "${x:-"}"}"' dash: 1: Syntax error: Unterminated quoted string http://austingroupbugs.net/view.php?id=221 note #399 Thanks, that helps to clarify. Unfortunately, the valid alternative given there:

Re: Quoted closing brace in variable default expansion

2010-11-13 Thread Jonathan Nieder
Hi Herald, Harald van Dijk wrote: > $ ksh -c 'echo "${x:-"}"}"' > } > $ dash -c 'echo "${x:-"}"}"' > dash: 1: Syntax error: Unterminated quoted string > $ busybox sh -c 'echo "${x:-"}"}"' > sh: syntax error: unterminated quoted string > > It looks like dash and other ash derivatives

Quoted closing brace in variable default expansion

2010-11-13 Thread Harald van Dijk
Hi all, It's probably best to start with the example: $ bash -c 'echo "${x:-"}"}"' } $ ksh -c 'echo "${x:-"}"}"' } $ dash -c 'echo "${x:-"}"}"' dash: 1: Syntax error: Unterminated quoted string $ busybox sh -c 'echo "${x:-"}"}"' sh: syntax error: unterminated quoted string It lo