Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
The most elegant and readable way (and efficient)
Message
De
11/12/2005 06:43:59
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01076714
Message ID:
01076952
Vues:
17
Hi Naomi,
>Anyway, I think gather works quite nice instead of building the replace command (though I considered it as well at first).

I responded to the "efficient" part, since that is mesurable.

For me, abstacting the logic into a string has other "nice" possibilities, for instance easy logging with strtofile(). Elegance is probably largely in the eye of the beholder: Using a scatter - approach I'ld probably just (scetchy pseudo)
scatter name loSource
loEmpty = createobject ("empty")
for lnRun = 1 to aelements(laProp,,,)
  if empty and ...
    addobject(loEmpty, laProp[m.lnRun], eval(laProp[m.lnRun])) && in a loop across the changeworthy properties,  
  endif
next
gather name loEmpty
from this already "pruned" object.

This way might actually be slower than Sergey's way, depending on the speed of addproperty in a loop vs. a single gather operation - not tested <g>. But for me the "elegance" would be in the possibility to log ONLY the resulting changes by iterating over all the properties of the previously "empty" object. As I said, in the eye of the beholder <bg>.

regds

thomas
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform