Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 342424

Summary: [Xbase] short circuit for boolean arithmetic operators used with boolean types
Product: [Modeling] TMF Reporter: Sven Efftinge <sven.efftinge>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: maxim.frolov, rvonmassow, sebastian.zarnekow
Version: 2.0.0Flags: sven.efftinge: indigo+
Target Milestone: M7   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Sven Efftinge CLA 2011-04-11 08:01:42 EDT
We need to support short circuit evaluation of boolean operators.
Unfortunately, this has to be baked into the language.
Comment 1 Sven Efftinge CLA 2011-04-11 08:26:00 EDT
*** Bug 342359 has been marked as a duplicate of this bug. ***
Comment 2 Sebastian Zarnekow CLA 2011-04-11 09:12:30 EDT
(In reply to comment #0)
> We need to support short circuit evaluation of boolean operators.
> Unfortunately, this has to be baked into the language.

An alternative would be to use annotations or some other kind of mapping information from extension methods to compiler / interpreter strategies, e.g.

class BooleanExtension {

  @CompileStrategy(BooleanCompiler.class)
  @InterpreterStrategy(BooleanInterpreter.class)
  boolean operator_and(boolean left, boolean right) {
    return left && right;
  }

}

This would allow to create more intuitive code for other extensions, too, e.g.

class IntExtension {
  int operator_plus(int left, int right) {
    return left + right;
  }
}

could be compiled to

result = left + right;
Comment 3 Sven Efftinge CLA 2011-04-11 09:14:55 EDT
I don't think it is worth the added complexity.
At least for Indigo we should simply hard code the special boolean case into the compiler and interpreter.
Comment 4 Sven Efftinge CLA 2011-04-13 04:52:00 EDT
*** Bug 342577 has been marked as a duplicate of this bug. ***
Comment 5 Sven Efftinge CLA 2011-04-13 09:42:31 EDT
pushed to master
Comment 6 Karsten Thoms CLA 2017-09-19 17:24:01 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 7 Karsten Thoms CLA 2017-09-19 17:35:41 EDT
Closing all bugs that were set to RESOLVED before Neon.0