Issue Details (XML | Word | Printable)

Key: JEXL-12
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: Matthew Firth
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons JEXL

[JEXL] Implement short-circuit boolean evaluation

Created: 14/Jun/04 03:36 PM   Updated: 09/Aug/06 04:33 AM
Return to search
Component/s: None
Affects Version/s: None
Fix Version/s: 1.0

Time Tracking:
Not Specified

File Attachments:
  Size
Text File short-circuit-eval.patch 2004-08-17 05:24 PM Matthew Firth 2 kB
Environment:
Operating System: All
Platform: All

Bugzilla Id: 29550


 Description  « Hide
The current implementation of ASTAndNode and ASTOrNode will evaluation both
sides of an expression before returning a result. I think most developers
these days seem to expect the RHS of an AND/OR expression to be ignored if the
LHS is sufficient to determine the result
(e.g. if A=>true, "A or B"=>true, regardless of B).

The patches appear to be trivial - if a committer is interested & thinks it
worthwhile I'll create them.

(btw, the old Turbo Pascal compiler described this optimisation as "short
circuit boolean evaluation"; I'm not sure if that is a common name for it.)



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
dIon Gillard added a comment - 17/Aug/04 11:14 AM
Sounds useful as well.

I'll take this one on.


Matthew Firth added a comment - 17/Aug/04 05:24 PM
Created an attachment (id=12457)
(tested) Patch to provide the enhancement I described.

dIon Gillard added a comment - 17/Aug/04 08:22 PM
Committed into CVS with tests

dIon Gillard added a comment - 17/Aug/04 08:28 PM
I did it a slightly longer-winded way, but there are tests too.