This project has moved and is read-only. For the latest updates, please go here.

Short-circuiting binary and/or operators

Jan 22, 2015 at 11:19 PM
Edited Jan 22, 2015 at 11:20 PM
Hi Roman!

I'd like to modify the expression evaluator to support short-circuiting binary operators like && and || in C# (AndAlso and OrElse in VB.NET), ensuring that an error is not thrown even though an operator is not defined between String and Int32 (bar<2) in the following:
foo = 1
bar = "test"
(foo==1) | (bar<2)
Is this a simple task or am I looking at a fair amount of changes to the code base in order to implement this?

Thanks in advance,
Jan 27, 2015 at 7:32 AM
Edited Jan 27, 2015 at 7:32 AM
it is already supported. Just evaluated:

x = true || (1 / 0 > 0)

the result is True; for expr:

x = false || (1/0 > 0)

shows error: attempt to divide by zero