This basically looks like a NAMESPACE whereby you can call its member functions through the
:: notation from the outside of that namespace.
The "functions within a function" ("closures") cannot be called from outside their parent function, only from the parent function code and from their siblings within that parent. The parent's own local and static variables are accessible to all its children down to the deepest nested level ("closures" can also be infinitely nested becoming "parents" to their own "children") but not vice versa.
That was the first step towards true encapsulation that already allowed the portions of app code to have neat formatting based on the parent/children's functional purpose.
The
gosubs' host and portions of code all share common variables that aren't isolated from one another in any way and cannot therefore reuse the variables' names for their own "local" purposes in a
gosub. ...
[ADDED] ...
unless the language has a SCOPE directive, like Charles has noted above, to arbitrarily limit the visibility of variables to within the scope bounds.