DASH Shell discussions
 help / color / mirror / Atom feed
From: Harald van Dijk <harald@gigawatt.nl>
To: dash@vger.kernel.org
Cc: Eric Blake <eblake@redhat.com>
Subject: Re: static vs. dynamic scoping
Date: Sun, 14 Nov 2010 00:21:51 +0059	[thread overview]
Message-ID: <4CDF1DA7.9000109@gigawatt.nl> (raw)
In-Reply-To: <4CD9C50D.5010305@redhat.com>

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 shell take care of restoring it afterwards. This works with 
ksh's typeset, but because of the static scoping only so long as no 
other shell functions get called, or those other shell functions also 
take the effort to handle IFS correctly. In the scripts I have been able 
to find, other shell functions do get called, but they themselves set 
IFS too. Still, it may be worth keeping in mind, if only to serve as one 
of the few examples of when dynamic scoping would have been slightly 
more useful.

  reply	other threads:[~2010-11-13 23:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-09 22:02 static vs. dynamic scoping Eric Blake
2010-11-13 23:22 ` Harald van Dijk [this message]
2010-11-13 23:54   ` ольга крыжановская
2010-11-14  0:10     ` Harald van Dijk
  -- strict thread matches above, loose matches on Subject: below --
2010-11-10 14:15 ольга крыжановская
2010-11-10 21:01 ` Jilles Tjoelker
     [not found] <4CD9C280.60007@redhat.com>
     [not found] ` <4CDA6301.1010703@gmail.com>
2010-11-10 15:13   ` Eric Blake
2010-11-15 21:11     ` Cedric Blancher
2010-11-15 21:45       ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CDF1DA7.9000109@gigawatt.nl \
    --to=harald@gigawatt.nl \
    --cc=dash@vger.kernel.org \
    --cc=eblake@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox