At 16:51 2015-07-07, Ken Dibble <[email protected]> wrote:

Gene stated:
VFP does not do lazy evaluation much at all! (The only exception to this that comes to mind is the second and third parameters to iif().)

Well, I was thinking of these types of cases:

PROCEDURE MyProc
     LOCAL var

    var = 4

    IF var = 4 OR anothervar = .T.  && anothervar is undefined
         RETURN "OK"
    ENDIF
ENDPROC

This will compile fine, and it will run without error as long as var = 4. VFP does not evaluate what comes after the OR in these cases. It is my

Yes, short-circuit evaluation with logical operators is common in languages.

understanding that some languages do evaluate all elements of the statement before attempting to resolve it, and will fail at runtime even if the code compiles.

     Yes.

On procedure calls, all of the parameters are going to be evaluated before executing the call except for rare cases. iif() is such a case. We can not create such procedures ourselves in VFP.

Sincerely,

Gene Wirchenko


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to