[Top][All Lists]

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

Re: [Help-bash] Closure concept in bash

From: Peng Yu
Subject: Re: [Help-bash] Closure concept in bash
Date: Tue, 31 Jan 2012 09:48:51 -0600

On Tue, Jan 31, 2012 at 9:35 AM, Greg Wooledge <address@hidden> wrote:
> On Tue, Jan 31, 2012 at 09:25:54AM -0600, Peng Yu wrote:
>> > How very bizarre.  I still don't quite understand the purpose, but I'll
>> > set it aside for now.
>> Because you don't quite understand the benefit of closure, you have
>> the following question.
>> The benefit of closure can be understood at least from the perspective
>> of refactoring. For example, you have a piece of refactored code that
>> uses many variables (say 10). Now you want to encapsulate it into a
>> function because you want to iterate through one of the variable.  [...]
> So... all this bizarre theory aside... what are you trying to DO?

I don't understand what you are asking. I have already explained it.

The conclusion is that bash doesn't have closure. The best that I can
use is set -a, which is like making variables "global" (it, of course,
has shortcomings). Closure could be a feature that may help in these
cases, but it may be not easily implemented in bash.

Bash need not be a language lacking advanced languages features. Bob
mentioned perl, python etc. These language can never beat bash in
terms calling shell commands. It will be cool to merge some good
features from other languages to bash to make bash better. As of now,
I think that closure is missing in bash and it could be a useful
feature to be added.

Just my 2 cents.


reply via email to

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