Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Intellisense in WITH ... ENDWITH
Message
De
01/09/2012 02:16:42
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
31/08/2012 10:53:44
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01550535
Message ID:
01552205
Vues:
56
>The next bit of code is what really bugs me about WITH. If from within the with, one calls a prg/udf of whatever where one accidentally left out the object reference, even by adding a period by mistake, the ?.Name will resolve all the way back to the last WITH. That's not explicitly clear and I have seen and debugged exactly such a thing and it was tiresome to say the least. Have not used with in years, still see no value in it whatsoever. With only saves typing that can just as easily be done with copy/paste.
>
>WITH m.oForm
>?Junk()
>ENDWITH
>
>PROCEDURE junk
>?.Name
>RETURN

I've found this extremely handy in the case where I needed to do a lot of snippets on a single scatter name object, without having to pass that object as a parameter to each, and there were more of a hundred of them, working on a few thousand records, so that would be an order of magnitude of 10K function calls. Specially neat, considering that this code may be called from a few different places, where I wouldn't know the name of the object in advance (so I couldn't use it as an inherited variable), and wanted to avoid passing a parameter (as that has its cost in a tight loop like this). Works like a charm, at the cost of writing a comment wherever this is called that it must be called within a with/endwith block.

And the snippets look a lot nicer.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform