Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Return statements within the with endwith blocks
Message
From
08/01/2017 06:02:03
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
07/01/2017 17:24:59
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
MS SQL Server
Miscellaneous
Thread ID:
01646361
Message ID:
01646391
Views:
45
>>>Hi everybody,
>>>
>>>I recall there were some issues of using return statements within with /endwith blocks. Can you point me out to some related blogs and is it still considered a bad practice to use them?
>>>
>>>Can they lead to VFP9 crashes (especially since there is ActiveX involved)?
>>
>>Personally witnessed a returning local var changing datatype in calling function when issued from within with..endwith.
>>Uncertain if it was with vfp6 or vfp8 libs.
>>After that having only single return statement was given higher priority and a simple code scanner to find returns inside with was written, run directly after next release with manual fixes.
>
>Maybe related to this: http://fox.wikis.com/wc.dll?Wiki~WithLeaksLocals ?

I'd agree with both Steven and Sergey on this one - this is by design, and the scope of with-endwith applies to a temp private variable that holds reference to the with-endwithed object. Or else with-endwith wouldn't be as useful as it is.

I know I've used this in several methods which are intended to be called from inside a with-endwith block, i.e. they contain a lot of .ref things without the corresponding with/endwith lines, which are left to the caller. Yes, a reference could be passed as a parameter but AFAIR I had some valid reasons for doing so. And it still works flawlessly.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform