Implicit access to last global
objectscriptQuality release
Id
OS0075
Rule type
Code Smell
Severity
Critical
Critical
SQALE characteristic
- Reliability
- Instruction
Remediation function
Constant/issue
Remediation cost
1h
Avoid the usage of a shortcut to access globals. Some of the reasons are:
- The developer must be aware of the context under which shortcut is being used.
- Avoid ambiguity in the global access.
- Obtain more clarity in code.
Noncompliant Code Example
In the code snippets below, it is supposed that the context of globals of the second snippet is that of the first snippet.
// In one part of the code... set ^foo("bar") = baz // In another part of the code... w ^("bar")
Compliant Solution
// In one part of the code... set ^foo("bar") = baz // In another part of the code... w ^foo("bar")