I don't know what would be the cost of it during compilation time or how difficult would be to implement it, but at first sight I think it could be a nice idea to allow defining functions inside other function bodies. Just like in Scala (
https://www.scala-lang.org/old/node/116.html), nested functions would be in scope only for parent functions.
I think it would improve readability to be able to encapsulate those "def do_work" functions within its related "def work" function. Maybe, to avoid crazy things, we could limit the allowed nesting deep to just 2.