Re: VFP Bug by glene77is
glene77is
Sat Dec 22 14:02:38 CST 2007
On Dec 15, 11:00=A0pm, "Steve Freides" <st...@fridayscomputer.com>
wrote:
> "Robert" <rob...@leriman.nl> wrote in message
>
> news:%23fQKxr3PIHA.748@TK2MSFTNGP04.phx.gbl...
>
> > Anders, thanks again, but I fail to see how the problem lies in 'what
> > I want'. I want the try/catch setup to work as specified. I think Eval
> > and macros substitution should be functionally equivalent in the given
> > code.
>
> Eval() and macro substitution have never been functionally equivalent.
> The idea of EVAL(), if memory serves, was that it would execute faster
> at run time than a macro, but the macro is tremendously flexible. =A0How
> many of us have written command line emulators with code like:
>
> DO WHILE whatever
> =A0 =A0 @ 23,0 SAY "." GET cmd
> =A0 =A0 &cmd
> ENDDO
>
> I know I have!
>
> -S-
>
>
>
> > Do you have any indication from the documentation or logical deduction
> > that I'm wrong on this? I could have missed something.
>
> > PS this is a hypothetical case from an interested VFP-er. As said, I
> > found the macros substitution is a perfect workaround for the problem
> > in my actual code.
>
> > Robert
>
> > Robert
> > Anders Altberg wrote:
> >> If you put
> >> Myfunction(nonExistingVariable)
> >> or a macro call
> >> =A0&strcode
> >> into the Try block you only get Goodbye
>
> >> Thus, the problem point is EVALUATE() as you showed. EVAL() and & do
> >> different things; you want them to do the same.
>
> >> -Anders
>
> >> "Robert" <rob...@leriman.nl> wrote in message
> >>news:uAGASPrPIHA.4740@TK2MSFTNGP02.phx.gbl...
> >>> Thanks. I have another view though. It would seem to me the order of
> >>> events is messed up.
>
> >>> If you step into the function, you can see that te message()
> >>> statement is
> >>> immediately updated to contain 'variable '' is not found', so the
> >>> error is
> >>> fired. However from there on I can step through the rest of the code
> >>> of
> >>> the function, even if I put a lot more code into the function. I can
> >>> even
> >>> call other functions, run programs and forms etc. from within the
> >>> function. This would bypass the purpose of the TRY/CATCH construct.
>
> >>> A function does not 'evaluate a variable'. In any programming
> >>> language,
> >>> when you call a function FIRST the variables are pushed on the stack
> >>> by
> >>> the calling routine and THEN the called function pops the variables
> >>> from
> >>> the stack into its code space. If he stack-pushing is unsuccessful,
> >>> an
> >>> error should be raised.
>
> >>> And way does the version with macro-subtitution work as expected?
>
> >>> Robert
>
> >>> Anders Altberg wrote:
> >>>> It displays 'hello' in VFP9 SP1 as well.
> >>>> Why not. The existance of this variable is not tested until the
> >>>> function
> >>>> Myfunction tries to evaluate it.
> >>>> IF you add a check in the try block the function doesn't get
> >>>> called.
>
> >>>> strCode =3D 'MyFunction(nonExistingVariable)'
> >>>> TRY
> >>>> EVALUATE('nonexistingvariable')
> >>>> Evaluate(strCode)
> >>>> Catch
> >>>> ?'goodbye'
> >>>> EndTry
>
> >>>> -Anders
>
> >>>> "Robert" <rob...@leriman.nl> wrote in message
> >>>>news:u$lPWOoPIHA.4584@TK2MSFTNGP03.phx.gbl...
> >>>>> The following code should not display 'hello', but it does on my
> >>>>> VFP9SP2.
>
> >>>>> strCode =3D 'MyFunction(nonExistingVariable)'
> >>>>> Try
> >>>>> Evaluate(strCode)
> >>>>> Catch
> >>>>> ?'goodbye'
> >>>>> EndTry
>
> >>>>> Function MyFunction
> >>>>> Lparameters abc
> >>>>> ?'hello'
> >>>>> EndFunc
>
> >>>>> Strange ha? The following code works ok:
>
> >>>>> strCode =3D 'MyFunction(nonExistingVariable)'
> >>>>> Try
> >>>>> &strCode
> >>>>> Catch
> >>>>> ?'goodbye'
> >>>>> EndTry
>
> >>>>> Function MyFunction
> >>>>> Lparameters abc
> >>>>> ?'hello'
> >>>>> EndFunc
>
> >>>>> A shorter version of the error is:
>
> >>>>> strCode =3D 'MessageBox(nonExistingVariable)'
> >>>>> Try
> >>>>> Evaluate(strCode)
> >>>>> Catch
> >>>>> ?'goodbye'
> >>>>> EndTry
>
> >>>>> What's your opionion, is this a bug?
>
> >>>>> I even have a feeling that there's a memory leak involved since
> >>>>> the
> >>>>> instruction pointer gets messed up somehow, which could explain
> >>>>> recent
> >>>>> crashes of my VFP
>
> >>>>> Robert- Hide quoted text -
>
> - Show quoted text -
Robert,
In the mid 80's, there was a FoxPlus emulator based on your little
code snippet.
They padded it with numerous routines in a library, and charged for
the package!
It was Fox_able without buying FoxPlus!
I ordered it, then sent it back.
Glen Ellis, Memphis, TN
www.GeoCities.com/glene77is