Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strong typing in visual foxpro
Message
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP1
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01049322
Message ID:
01049383
Views:
16
>> Is there any way to accomplish strong typed programming
>> in visual foxpro class that are created with visual foxpro
>> class creation tool. For example how can i say a class method
>> returns an integer value with "as integer"?
>
>No, VFP is a "late binding" language. Strong typing can not be accomplished. The only thing You can do is use naming conventions and discipline. You can initialize a numeric return-Value that will be altered when the method runs trough properly, and if not, the initial Value is returned.
>
>The following will surely cause problems
>
>
>procedure ValidFile(tcFile as string) as integer
>
>if vartype(tcFile) # "C"
>   return
>endif
>
>return iif( file(tcFile), 1, 0)
>endproc
>
>
>as You might get a type logical *or* nurmeric
>
>however this will work
>
>
>procedure ValidFile(tcFile as string) as integer
>
>local lnRetVal
>lnRetVal = -1
>
>if vartype(tcFile) # "C"
>   return lnRetVal
>endif
>
>lnRetVal =  iif( file(tcFile), 1, 0)
>return lnRetVal
>endproc
>
How about using only one return statement in the function/procedure? I know, it's could be very difficult...
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform