Re: scope of variables
- Posted by jimcbrown (admin) Dec 30, 2010
- 2830 views
It occurs to me that the current behavior is inconsistent with respect to forward referencing.
You can't forward reference inside a procedure.
You can do this at the file level.
This breaks:
procedure x() b = 1 integer b end procedure
This works:
procedure x() b = 1 end procedure x() integer b
But this breaks:
b = 1 integer b
It does seem like routine-scopes are already handled specially. Maybe we can contiue to justify the special treatment of routine-scopes (backwards compatible symbol shadowing remains supported) while changing the rest (so integer b...for...integer b...end for and for...integer b...end for..integer b both break).
On the other hand, it might be easier to make all scoping rules apply equally to all the different scopes.