Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VARTYPE() vs PEMSTATUS()
Message
From
09/01/2009 10:12:23
 
 
To
09/01/2009 09:12:06
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01372210
Message ID:
01372352
Views:
22
>>>Then why all the PEMSTATUS and VARTYPE stuff if TYPE is all you need?
>>
>>PEMSTATUS() also lets you check whether a method exists before you call it. I use it a lot in framework code.
>>
>>As for VARTYPE(), we have it because we asked for it. Using TYPE() correctly is tricky--do you need quotes or not? VARTYPE() is easier and faster, though it's meant only for cases when you already know the thing exists. I use it on parameters a lot.
>>
>>Tamar
>
>This is from the help:
>
>VARTYPE( ) is similar to the TYPE( ) function, but VARTYPE( ) is faster and does not require quotation marks ("") 
>to enclose the specified expression.
>
> They make it sound like they are interchangeable, but according to some posts here there seems to be problems in using VARTYPE in certain situations.

VARTYPE() is born with many bugs,
some are fixed, others are not fixed.

But TYPE is not the universal answer:
CLEAR

ON ERROR ?? "ERROR: "+MESSAGE()
test()
DIMENSION something[3]
something = 'blabla'

? "--------- AFTER ------"

test()


PROCEDURE something
	RETURN DATE()
ENDPROC


PROCEDURE test

? TYPE("something()")	&& TYPE return "U" for every bad syntax
? TYPE("1+''")			&& TYPE return "U" for every bad syntax
? TYPE("something(2)")  && TYPE don't call UDF
? VARTYPE(something(2)) && VARTYPE call array or UDF
? VARTYPE(something())  && VARTYPE call UDF but an array exists the fire a error !
ENDPROC
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform