Currently, the string implementations of comparison operations unconditionally convert the right-hand-side of the comparison to a string value. This means compares like
if arg == .nil then ....
If the variable arg is .nil, then these objects are compared directly. If variable arg is a string value, .nil gets converted to the string "The NIL object" and this value is compared. This has two problems:
1) There is a potential for a false positive on this compare if the string value happens to be the string "The NIL object"
2) a NOSTRING condition is raised, which causes unexpected problems if SIGNAL ON ANY is in use.
The workaround is to code "if .nil == arg then ..." to get .nil on the left side of the operator. In practice, people almost universally prefer the first form. Comparison to .nil is such an important thing on the ooRexx language that the string class should recognize .nil as a special case and always return .false (avoiding the NOSTRING condition as well).
Anonymous
code committed [r8242]
tests committed [r8243]
docs committed [r8244]
Related
Commit: [r8242]
Commit: [r8243]
Commit: [r8244]
Some fixes for this feature
code: [r8286]
test: [r8287]
Related
Commit: [r8286]
Commit: [r8287]