Named Scopes (was Re: Feature requests for Eu 2.5.)
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Aug 20, 2003
- 433 views
I decided to post this separate from my reply to CC, to stop it getting buried. I do like the idea of named scopes. My view is something like: scope scopename <variables, constants, routines, and include files> end scope scopename <illegal to reference anything in scopename here> procedure xxxx() use scopename ... <can use items from scopename here> end procedure <illegal to reference anything in scopename here> use scopename .. <can use items from scopename here> .. <end of file> scopes may optionally be global. If the global keyword is used anywhere inside a named scope, it makes the definition available throughout the scope (ie to any includes inside the scope), but not global outside the scope. The XXX has not been declared error should probably be followed with a message XXXX is however defined in named scope x, similar to the namespace qualifier is required message. When use scopename is coded, the <toplevel> local symbols in it can be referenced, even if it the scope is defined in another file. I can't see any obvious difficulty nesting scopes, of course a use outerscope statement does not grant access to innerscope. It should however be possible to code use outerscope use innerscope but only if innerscope is declared global. Pete