Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sequential In-Line Function Calls
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Sequential In-Line Function Calls
Divers
Thread ID:
01508815
Message ID:
01508815
Vues:
133
I've been dabbling in different languages lately (Python, Ruby on Rails, C#, etc.) and one thing I found that I really like with Ruby is the sequential in-line function calls.

In VFP we work inside out which isn't easy to read:
myudf(padr(trim(str(lnVariable)),10))
In Ruby (using VFP methods) the same thing would be like this:
lnVariable.str().trim().padr(10).myudf()
The sequential way is SO much more readable. Here's my question. Generically, what do you call this difference/paradigm (as I'm sure it's not called Sequential In-Line Function Calls) ?

Secondly, how easy would it be to create this capability in VFP?

Here's a really short (and bad) sample that illustrates the idea.
** SILF.prg - Sequential In-Line Function
** Allow us to make Ruby type calls
** lxValue = original source value
** lcF = functions calls use pipe | for proper variable placement
**
** Example call: SILF(5,[STR(|).ALLTRIM(|).PADL(|,3,'0')])
LPARAMETERS lxValue,lcF

LOCAL lnX,lnFCount,lxReturnValue
lnFCount=GETWORDCOUNT(lcF,[.])
lxReturnValue=lxValue

FOR lnX=1 TO lnFCount
	lxReturnValue=EVALUATE(STRTRAN(GETWORDNUM(lcF,lnX,[.]),[|],[lxReturnValue]))
ENDFOR

RETURN lxReturnValue
Brandon Harker
Sebae Data Solutions
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform