Sample Header Ad - 728x90

How to keep a local function private in a zsh `autoload` module?

0 votes
1 answer
32 views
I want to define a helper function in a zsh autoload-ed module. The problem is, if I just define in my my_autoloaded_fn file such as
function helper {
  # ...
}

helper a
helper b
the name helper will become defined in the global namespace once my_autoloaded_fn is invoked. I tried also
local helper
function helper {
  # ...
}
but the local declaration seems to have no effect. And neither local -f works.
Asked by Petr (1776 rep)
May 19, 2025, 01:28 PM