In C, one can declare static variables with local function scope (example).
Can something similar be done in Julia?
My use case is declaring sub-functions, but do not want Julia to have to reparse them every time the code executes. Declaring them outside of the function is ugly and gives them higher scope, which I want to avoid.
example:
function foo(x)
static bar = t -> stuff with t
...
bar(y)
...
end
While I could declare bar() outside of foo(), I would prefer bar to only be in the local namespace.
Thank you.