[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] Why define one function inside another (bash, awk)?
- Subject: [ale] Why define one function inside another (bash, awk)?
- From: leamhall at gmail.com (leam hall)
- Date: Wed, 24 May 2017 12:10:21 -0400
- In-reply-to: <CAAt=rgBNu2-0T8GPANXAnM4G3s6bKG6-Fn6arc1dMM0qv01KeA@mail.gmail.com>
- References: <CACv9p5ryAWQ3Cek4Y-vCLc11prUEkfLame6x3p1SB8Entr8fxg@mail.gmail.com> <CAAt=rgBNu2-0T8GPANXAnM4G3s6bKG6-Fn6arc1dMM0qv01KeA@mail.gmail.com>
So a usage issue? No significant performance degradation if the calling
script is already sourcing other files?
I'm looking at multiple scripts each at 30+ pages of code and trying to
figure out how to explain why smaller and less complex can be better.
And explain it without cussing...
Leam
On Wed, May 24, 2017 at 11:29 AM, James Sumners <james.sumners at gmail.com>
wrote:
> Scope. While Bash doesn't have any concept of a closure, it is sometimes
> helpful to know that the internally defined function is meant to only be
> used locally within that parent function.
>
> On Wed, May 24, 2017 at 11:22 AM, leam hall <leamhall at gmail.com> wrote:
>
>> I see people do this and I'm not sure why. Is there any technical
>> advantage to defining a function inside another, assuming it could be
>> defined outside and used inside?
>>
>> Thanks!
>>
>> Leam
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20170524/66fc416e/attachment.html>