Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is a parameter an array?
Message
From
13/11/2003 04:13:51
 
 
To
12/11/2003 15:47:51
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00848944
Message ID:
00849427
Views:
23
Hi Stefan,

-----------------
No, before I started this reply I did not know that square brackets can be used in function calls as well as in arrays ...


? iif[.f., 1, 2]
: 2
----------------

This ambiguity of the language is Terrible.

You can use:
DIMENSION m.sqrt[1],m.int(1)

? m.sqrt[1],m.int(1),m.sqrt(1),m.int[1]
? sqrt[1],int(1),sqrt(1),int[1]
It is useful only for implement a cache table function on an parametric code program, where a function can, at runtime, be replaced from an computed Array ( if func calc time is long ... ).
CLEAR
? calcFunc[5],calcFunc(5)
DIMENSION calcFunc(10)
* VFP search on var list, and after on procedure list
FOR k=1 TO 10
   m.calcFunc(m.k)=calcFunc(m.k)
NEXT
? calcFunc[5],calcFunc(5)
RELEASE calcFunc
DIMENSION dummy(10)
FOR k=1 TO 10
   dummy(m.k)=calcFunc(m.k)
NEXT
DIMENSION calcFunc(10)
ACOPY(dummy,calcFunc)
* now VFP ignore function
? calcFunc[5],calcFunc(5)

FUNCTION calcFunc(p1)
 ?? 'X'
 RETURN p1%20
ENDFUNC
but this is a very crypt code.

Fabio
Previous
Reply
Map
View

Click here to load this message in the networking platform