Re: rant // OE scope \\ forked out of 500 Rosetta
- Posted by _tom (admin) 1 week ago
- 98 views
Not a fan of the water-space model to explain scope. Seems just way to complicated. Of course that might not be able to be avoided.
I'll take 0/10 and call it a pass (seems like a generous score given the state of education here...).
The model gets very messy when you consider include files that include files.
Space has to be explained somehow because of the namespace keyword, and the include ... as [namespace prefix] way include files are designed.
Then, once you know what "space" is, you must learn "scope".
Then it follows that a block (say in a loop or routine) is a subspace with new scope features.
Again, this gets messy and hard to diagram.
I've just added: It may help to think of "in scope" as meaning "does not cause a compilation error".
I was trying "in-scope things work".
This is the pragmatic model that programmers have in their head and they don't think about it. But, how does one explain this to someone new?
The good thing about Euphoria languages is that the Interpreter lets you find and fix scope errors quickly.