Re: Nested functions - better example?
- Posted by katsmeow Jan 13, 2021
- 862 views
petelomax said...
katsmeow said...
The inner functions have access to the outer function's variables.
WHOAH! Alas not, since that would require a closure. Let me explain.
Bear in mind I've only just changed this, post-0.8.2, so all is not set in stone.
Alas yeas, it's why i wrote nested functions in Turbo Pascal on win3.0 way back when.
Of course, you can do it differently in Phix, doing so merely reduces (not eliminates, i suspect) the value in having such nests. I am not voting for or against it. Eu doesn't allow it either, and in Eu i'd just drop the "outer" and "inner" in their own include file to get fine-grained scoping, which i have done more than once. Not a problem.
Kat