Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Where did .tdx come from?
Message
From
20/06/2001 12:56:14
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
20/06/2001 12:03:08
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Miscellaneous
Thread ID:
00521213
Message ID:
00521557
Views:
14
>>One good reason for using .tdx for on the fly indexes is so at cleanup you can delete all the *.tdx files without worrying if it's a real index.
>
>Thanks David,
>It's nice to know there's a modicum of reasoning there.
>
>Another quickie:
>This programmer used a lot of UDF's and evaluations.
>eg. = prog()
>
>This makes me wonder:
>Which is better to use; '=' or 'DO'? Why?
>
>TIA
>Pete

Pete,
This is more of a style :) My preference is almost always myProg() style.
Depends and has also roots from old fox2x.
'do' by default passes parameters by ref. where myprog() passes by val. Here 'do' seems to be sometimes preferable over myProg() where you can get multiple return values. OTOH since it passes by ref called proc/func/method could alter the values including those not meant to be changed and yet myProg() style could do same by adding @ regardless of 'set udfparms'. Otherwise it would depend on called prog preserving the variables or not.
local lnValue1, lnValue2, lnresult1, lnresult2
lnValue1 = 2
lnValue2 = 5
do mymultiplier with lnValue1, lnValue2, lnresult1, lnResult2
lnResult2 = mymultiplier(lnValue1, lnValue2, lnresult1)
? lnValue1, lnValue2, lnresult1, lnresult2
lnValue1 = 2
lnValue2 = 5
store 0 to lnresult1, lnResult2
lnRetValue = mymultiplier(lnValue1, lnValue2, lnresult1, lnResult2)
? lnValue1, lnValue2, lnresult1, lnresult2,lnRetvalue
lnRetValue = mymultiplier(lnValue1, lnValue2, @lnresult1, @lnResult2)
? lnValue1, lnValue2, lnresult1, lnresult2,lnRetvalue


function myMultiplier
lparameters tnVal1, tnVal2, tnResult1, tnResult2
tnResult1 = tnVal1 * tnVal2 + 5
return tnVal1 * tnVal2
All function (and procs/methods/events) return a value and you should have '=' even you were to discard it in old days. ie:

handle = fcreate('test.txt')
fwrite(handle,'hello')
fclose(handle)

works now. But wouldn't in old days and should be :

handle = fcreate('test.txt')
=fwrite(handle,'hello')
=fclose(handle)

on key label 'F1' do myprog with myParam
works.
on key label 'F1' =myprog(myParam)
fails.
on key label 'F1' m.xx=myprog(myParam)
on key label 'F1' store myprog(myParam) to m.dummy
works.

myProg() style is also generally short coding :) ie:
do myProg1 with 'test' to lcRetVal
do myProg2 with lcRetVal to llRetVal
if llRetVal
  do myProg3 to llRetVal
  if llRetVal
    do myProg4 to llRetVal
  endif
endif
if !llRetVal && Do something for fail
*...
endif

* = style
if !(myProg2(myProg1('test')) and myProc3() and myProc4()) 
&& Do something for fail
*...
endif
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform