Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WITH object
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01671871
Message ID:
01671896
Views:
79
>Readability of code in most situations is more important than the minuscule micro-optimization speed improvements that one property access mechanism may have over another.

33% faster. Not minuscule.

>I doubt there are many situations where the performance difference would actually matter - if you're looping over 100's of thousands of objects maybe. Otherwise, other things are going to be much more expensive and wipe out any gains of that.

It's more of an interesting find / research project. I could see it having uses in some cases, especially with the 33% improvement in performance. It would also be a very fast way to aggregate common parameters on an object, and pass in a single implicit reference.

>One of the reasons I don't like WITH is because IMHO it makes code much less obvious as you have to always contextually link back to the WITH assignment especially in large blocks. Having to write out a variable name is a one time thing that has little to no overhead at runtime.

WITH..ENDWITH has its place. I do like the suggestion someone else had recently:
lo = some.long.object.reference
lo.property = whatever
lo.method()
Making the shorter reference into a disposable variable is a nice trade off.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform