#Dim directive with no associated type

objectscriptQuality release 
1.0.0
Id 
OS0045
Rule type 
Code Smell
Severity 

Major

Major
SQALE characteristic 
  • Maintainability
    • Readability
Tags 
coding-guidelines, maintainability
Remediation function 
Constant/issue
Remediation cost 
15min

The #Dim preprocessor directive, even though the documentation does not mention it, can be used without specifying the intended type of the variable, as in:

    #dim x

However, this defeats the purpose of this directive; among other things, this prevents Studio from performing completion of properties/methods/etc.

It is recommended that a type be declared at all times, as in, for example:

    #dim x as %Integer