Re: Forward reference to included function
- Posted by _tom (admin) Jan 15, 2014
- 1540 views
I don't see the difference between declared and defined in euphoria.
I was seeing "defined" as a variable after being assigned a value. But, since you can use atom(x) before an assignment I now understand how we just need "declared".
This probably means I can do a search and replace on all (most) occurances of "define" in the documentation and replace them with "declare".
This simplifies the first diagram.
Second diagram: This isn't quite right. A variable or constant declared anywhere in the file at top level is visible from inside a routine that is located anywhere in the file.
This I don't understand:
It suggests to me that this should work:
foo() procedure foo() ? x end procedure atom x = 1 -- variable x has not been assigned a value
But what actually works is:
atom x = 1 foo() procedure foo() ? x end procedure
Both of these are subject to the caveat that code at a higher scope level cannot see variables declared at a lower level (e.g., a variable declared within a loop is not visible outside of that loop). I may have higher/lower confused.
Creating a diagram to explain nested scopes is going to take some work.
_tom