Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WITH object
Message
From
15/11/2019 20:49:10
John Ryan
Captain-Cooker Appreciation Society
Taumata Whakatangi ..., New Zealand
 
 
To
15/11/2019 17:36:39
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01671871
Message ID:
01671902
Views:
70
>>By the way, the 33% gain exists on every call.

I believe I saw WITH performance benefits confirmed by another Rick (Rick Schummer) many years ago in a discussion that I think also involved Doug Hennig, to the effect that WITH is useful in sequences of 3 or more property accesses or method calls. If you're saying there's a benefit with even one access, that I did not know.

I wouldn't hesitate to use WITH in routines that need to be very quick.

However, I think the others make a good point about potential glitches and maintenance issues if WITH is used everywhere and you end up having to scroll up and down to confirm which object .myproperty(.myproperty2) applies to this time. I've never minded a few lines of redundant code or object naming if it means the code is easier to follow in a year or two. And certainly at one stage it was unwise to RETURN from between WITH...ENDWITH if you enjoy application stability. That might have been improved in VFP9, but I've no appetite to find out. Also worth noting fun times enjoyed by all some years back when a developer left one . prefix off in a forest of implied SCATTER OBJECT properties and there was a variable/field of same name.
"... They ne'er cared for us
yet: suffer us to famish, and their store-houses
crammed with grain; make edicts for usury, to
support usurers; repeal daily any wholesome act
established against the rich, and provide more
piercing statutes daily, to chain up and restrain
the poor. If the wars eat us not up, they will; and
there's all the love they bear us.
"
-- Shakespeare: Coriolanus, Act 1, scene 1
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform