Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 342424 - [Xbase] short circuit for boolean arithmetic operators used with boolean types
Summary: [Xbase] short circuit for boolean arithmetic operators used with boolean types
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.0   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 enhancement (vote)
Target Milestone: M7   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 342359 342577 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-04-11 08:01 EDT by Sven Efftinge CLA
Modified: 2017-09-19 17:35 EDT (History)
3 users (show)

See Also:
sven.efftinge: indigo+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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