TYPE()            Comments on Clipper 5.0 return values.

Clipper Version 1.29 dtd 04/15/91.

Problem Statement

1) TYPE("LocalVar" or "StaticVar") returns 'U'.

2) Successive uses of TYPE may produce erroneous values; e.g.,

? TYPE( "{| a | Foo( a ), }" ) // Prints "UE", syntax error.

? TYPE( "{| a | Foo( a ), .T. }" ) // Error has been corrected, but
// TYPE() still returns "UE".
? TYPE( "{| a | Foo( a ), .T. }" ) // This time, TYPE() returns "B".

Cause

1) TYPE("xVar") uses macro expansion to evaluate variables.

2) Unknown.

Work Around(s)

1) Use VALTYPE(var)

2) Use a function; e.g., the following by Michael Vivino 72210,2630

FUNCTION ChkBlock( cBlock )
TYPE( "{|| .T. }" ) // reset any prior error by passing
// a valid block to type()
RETURN TYPE( cBlock ) == [B] // Now syntax-check the passed block

Notes

TYPE("Undeclared_Var") Returns 'U'
VALTYPE(Undeclared_Var) Returns runtime error