help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] Closure concept in bash


From: Chet Ramey
Subject: Re: [Help-bash] Closure concept in bash
Date: Tue, 31 Jan 2012 09:40:10 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0) Gecko/20111105 Thunderbird/8.0

On 1/31/12 8:47 AM, Greg Wooledge wrote:
> On Mon, Jan 30, 2012 at 09:32:14PM -0600, Peng Yu wrote:
>>> What do you mean by "closure"?
>>
>> See here for the explanation of closure.
>> http://en.wikipedia.org/wiki/Closure_%28computer_science%29
> 
>  "In computer science, a closure (also lexical closure, function closure,
>  function value or functional value) is a function together with a referencing
>  environment for the non-local variables of that function.[1] A closure allows
>  a function to access variables outside its typical scope."

It's just another encapsulation mechanism.  The shell's most useful
equivalent is the shell script, since, as you noted, the process
environment is fragile when used for this.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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