9 years
edited 8 years
True and False BooleanExpressions
Credits goes to Vexorian for the first idea.
Vjass version
Zinc version
Credits goes to Vexorian for the first idea.
Vjass version
library BoolexprUtils
globals
boolexpr BOOLEXPR_TRUE
boolexpr BOOLEXPR_FALSE
endglobals
private module Init
private static method filterTrue takes nothing returns boolean
return true
endmethod
private static method filterFalse takes nothing returns boolean
return false
endmethod
private static method onInit takes nothing returns nothing
set BOOLEXPR_TRUE = Filter(function thistype.filterTrue)
set BOOLEXPR_TRUE = Filter(function thistype.filterFalse)
endmethod
endmodule
private struct S extends array
implement Init
endstruct
endlibraryZinc version
//! zinc
library BoolexprUtils {
public boolexpr BOOLEXPR_TRUE, BOOLEXPR_FALSE;
module Init {
static method onInit() {
BOOLEXPR_TRUE = Filter(function() -> boolean {return true;});
BOOLEXPR_FALSE = Filter(function() -> boolean {return false;});
}
}
struct S extends array {module Init;}
}
//! endzinc
