- Notifications
You must be signed in to change notification settings - Fork0
Open
Description
Currently functions have unfettered access to variables in higher scopes - be it the program's globals, or the caller's variables. This is a really stupid design decision that should be changed.
Proposed solution:
- Limit functions to accessing only their local variables (and args/statics)
- To use global variables, one must explicitly declare their use with
!global $varname
- The construct should probably be limited to the function's top-level scope (can't be put inside
!if
or loops)
Things to consider:
- Should
!global $var
and!global &var
be equivalent, or should the first one create a copy of the global variable in local scope (instead of adding a reference)? - What should happen when a function calls
!global &var
and&var
hasn't been yet set?
Metadata
Metadata
Assignees
Labels
No labels