|Date: 2013-03-15 14:43:15||Priority: Moderate|
: Cadre Bugs
Octavia doesn't currently support any implicit scope mechanisms at all. You have the $_caller object and local variables, and that's it—no globals! This is a big problem. Decide on a method of referencing non-local variables and make it work.
Options: PHP's "global", perl's "local"...
I'm guessing there will be "page", "global", and "local" variables.
For best backward compatibility, use declarations. Leave undeclared variables the way they are, and then have modal foo;
and global foo;
for things kept in an object or mode call and its descendants and things that are fully of the session, respectively. May need to rename $_GLOBAL to $_UNIVERSAL...
Regarding the precise meaning of modal
1. A function call does not disturb modal variables, unless it is a function call from a live object, even if that live object is the one currently executing. Function calls from live objects are "after-market" modes as of #2071
, and are distinguished from preamble or immediately-declared functions.
2. All mode calls disturb modal variables.
3. Dynamic function (executability = 4) calls disturb modal variables, since they're really just syntactic sugar for view
...another thought is the introduction of sessional
variables, which would be stored as cookies.
The implementation of scope is a little messy and fairly complex. See #2089
for a description. The rule is basically "greedily consume lexical scope, but go back and search for dynamic scope if that fails."