You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
.AND. / .OR. / .NOT. written without spaces are parsed as member access – compiles silently and fails at run time #28
Visual FoxPro accepts the logical operators written directly against their operands, with no spaces. Code written in the FoxPro 2.x era uses this style everywhere. FoxDev parses name.AND.name as a chain of member accesses. Depending on what follows the operator, the result is either a syntax error or, worse, code that compiles cleanly and then fails at run time.
Repro A – compiles, fails at run time
LOCAL x, y
x = .T.
y = .F.
? x.AND.y
? x .AND. y
foxvm check → ok (0 warning(s))
foxvm disasm → line 4 is compiled as LoadLocal(0) GetMember("AND") GetMember("y")
foxvm run → Error 1924 in 01B_SILENT line 4: AND is not an object.
Repro B – syntax errors
LOCAL x, y
x = 1
y = 2IF x=1.AND.y=2 && OK (a numeric literal precedes the operator)
ENDIFIFEMPTY(x).OR.!EMPTY(y) && error: expected member name, found '!'ENDIFIF .NOT.EMPTY(x).AND..NOT.EMPTY(y) && error: expected member name, found '.NOT.'
ENDIF
Expected
Same as VFP 9: .AND., .OR. and .NOT. are operator tokens wherever they appear, including straight after an identifier, ) or ]. VFP never reads x.AND.y as member access, so the input is not ambiguous.
Impact
In a sample of ~25k lines of a real application we found 119 occurrences of the silent name.AND.name / name.OR.name form alone, plus over 100 that produce a syntax error. Today code like this can't be checked statically: a clean foxvm check does not mean the program runs.
Activity