bug-bash
[Top][All Lists]
Advanced

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

Re: There's no way to declare a function local to another function.


From: Robert Elz
Subject: Re: There's no way to declare a function local to another function.
Date: Wed, 11 Jun 2025 06:02:46 +0700

    Date:        Tue, 10 Jun 2025 17:34:44 -0400
    From:        Zachary Santer <zsanter@gmail.com>
    Message-ID:  
<CABkLJUJAwdPWzC8qoJ2Fx6Wwa=rkMaT-RYpCU8QZb7GN4uyYHQ@mail.gmail.com>

  | Functions can be declared inside of other functions, so I thought
  | doing the following was pretty slick:

Function definitions aren't declarations in any sense similar to
other programming languages.   They are executable statements, which
can be executed, conditionally or not, at any point in the code, and
when executed create the function globally.

kre

ps: putting a function definition inside a loop is generally not
a useful thing to do, unless its definition varies from iteration to
iteration, in which case the loop probably also wants to unset it
at some point as well.





reply via email to

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