EQ2Interface

EQ2Interface (https://www.eq2interface.com/forums/index.php)
-   UI Developer Discussion (https://www.eq2interface.com/forums/forumdisplay.php?f=3)
-   -   Short Circuit Booleans? (https://www.eq2interface.com/forums/showthread.php?t=15888)

kdmorse 08-14-2011 04:32 PM

Short Circuit Booleans?
 
I'm sure the answer is no, but I thought I'd ask.

Does the UI language perform short circuit boolean evaluations? Or does it fully evaluate all expressions even when unnecessary?

ie, if one were to code something like:

Result=( X || Text==Parent.Parent.Something )

Would the text compare be performed even if X is already set to True? (Making the text comparison unnecessary?) Or would it do the text compare anyway?

kdmorse 08-14-2011 05:02 PM

And while I'm at it, do we have an XOR operator, or a logical Not?

So far, my attempts at anything like Test=( !X ) have not worked. I had to resort to Test=X ? false : true.

EQAditu 08-14-2011 07:08 PM

I don't think anyone outside of SoE could tell you that unless they benchmarked a huge number of iterations of such. Though I sort of wonder why you care.

Secondly, I couldn't tell you if it's the case for your example, but often the UI evaluates things right to left, but your assumption in your example assumes it checks the left side of the || first instead.

Thirdly, there are situations where you can and cannot have several evaluations on a single line. If you can get a multi-boolean evaluation to work there, good for you... but I never try to make it do complicated things because they just cause debugging headaches when it decides not to work.

There's some sort of operator thread stickied someplace... if you haven't found it in there, it probably doesn't exist. Trying to use random ones from other languages is probably futile. The UI scripting language isn't really based on any standard as much as it borrows random things.

gm9 08-14-2011 07:37 PM

Quote:

Originally Posted by kdmorse (Post 98069)
And while I'm at it, do we have an XOR operator, or a logical Not?

So far, my attempts at anything like Test=( !X ) have not worked. I had to resort to Test=X ? false : true.

The operator, as in other programming languages, is !=. In XML write it as '!'=.

As to your first question, the answer is no, but that's because you have to pre-evaluate your expressions anyway, the example code you posted will not work.


All times are GMT -5. The time now is 12:21 PM.

vBulletin® - Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© MMOUI