Implicit access to last global

CachéQuality release 
1.0.2
Id 
OS0075
Rule type 
Severity 

Critical

Critical
SQALE characteristic 
  • Reliability
    • Instruction
Tags 
clarity, coding-guidelines, confusing
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")