At 14:27 2017-05-10, Fred Taylor fbtaylor@gmail.com wrote:
It actually runs. Scary, huh!
Very.
It means that a WITH block has execution scope, not lexical scope.
It might be why some people have trouble with WITH.
Suppose a caller has one or more WITH blocks open and calls a method. If the called method uses WITH, the object references are not going to be what is expected. There is nothing the called method can do about it and still use WITH.
[snip]
Sincerely,
Gene Wirchenko
No, I think the called method, if it uses WITH/ENDWITH, it would be OK. WITH/ENDWITH seems to be stack oriented even across calling levels, but where you are in the stack may not be what you expect for anything outside of a defined WITH/ENDWITH in the called method.
_screen.addobject("oz","grid") _screen.oz.Visible = .t. WITH _screen.oz test() && level 1 in stack WITH .Columns(1) test() && level 2 in stack WNDWITH ENDWITH RETURN
FUNCTION test .left = 250 && who knows what level this is??? Or what the object reference might be (in this example, the second call would fail as a Column does not have a .Left property) WITH somenewobject * code here is on it's own WITH level added to the stack * from the first call, this would be level 2 in the stack * from the second call this would be level 3 in the stack * No harm as long as we don't care about anything outside of this WITH/ENDWITH block ENDWITH RETURN
Fred
On Wed, May 10, 2017 at 3:17 PM, Gene Wirchenko genew@telus.net wrote:
At 14:27 2017-05-10, Fred Taylor fbtaylor@gmail.com wrote:
It actually runs. Scary, huh!
Very. It means that a WITH block has execution scope, not lexical scope. It might be why some people have trouble with WITH. Suppose a caller has one or more WITH blocks open and calls amethod. If the called method uses WITH, the object references are not going to be what is expected. There is nothing the called method can do about it and still use WITH.
[snip]
Sincerely,
Gene Wirchenko
[excessive quoting removed by server]