Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Switch with refinements/hmmm!

From: media:quazart at: 2-Nov-2001 9:04

Hi Joel, we are saying the same thing... as we both said, "any/all" improves readability and then depending on the actual code you have to perform after the "filter" you must just make sure that it works. here is a little trick to improve speed ;-) refa: true refb: true refc: false any [ all [refa refb refc ( print "A and B and C" true)] all [refa refb ( myvar: none print "A and B" true)] all [refc ( print "nothing set" true)] ] I'm not trying to prove anything or you wrong... I'm just giving you a little trick to prevent a short cicuit. In most cases, by putting your stuff in a little set of parenthesis and ending it with a true... you prevent the expression from short-circuiting. Even though (like in this example) I set something to none, the print statement still executes, because all is only concerned with what the expression returns... in this case its always true... so it wont evaluate anything else... consider the following: refa: true refb: false refc: true any [ all [refa ( print "A " false)] all [refb ( myvar: none print "B" false)] all [refc ( print "C" false)] ] here every true reference will be called... peace ;-) -MAx