Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
EVL and NVL
Message
From
19/05/2004 09:40:35
 
 
To
19/05/2004 09:14:21
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00905138
Message ID:
00905256
Views:
16
Hi


I am quite sure you know this, but for anyone else who is reading: the "slow to evaluate" part is not always the worst effect. The worst effect is the possibility of "side effects", if a function gets executed when you don't expect it.


Yes, but for this case,
a conditional evaluation of parameters it is out from every rule of programming.

If a like EVL() or NVL() behaviour is implemented with a operation logic,
then the code can to be into a special programming case:
* EVL(Exp1,Exp2,Exp3,Exp4) implemented with next syntax
=Exp1 .IFEMPTY. Exp2 .IFEMPTY. Exp3 .IFEMPTY. Exp4
* NVL(Exp1,Exp2,Exp3,Exp4) implemented with next syntax
=Exp1 .IFNULL. Exp2 .IFNULL. Exp3 .IFNULL. Exp4
But this schema have side effects, too.

Example:
* this is simple and clear
IF doOperation1()
  IF  doOperation2() && executed for doOperation1() = .T.
      doOperation3() && executed for doOperation1() AND doOperation2() = .T.
  ENDIF
ENDIF
* a developer can use this, but this is not equal to the previous code
= doOperation1() ;
 .AND. doOperation2() ; && executed for doOperation1() = .T. or .NULL.
    .AND. doOperation3() && executed for (doOperation1() = .T. or .NULL.) AND (doOperation2() = .T. or .NULL.)
Fabio
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform