Closed JensN4 closed 10 years ago
It is now possible to use rule invocations corresponding to predicate judgments, i.e., judgments without output parameters, in contexts where a boolean expression is expected, e.g., inside lambdas and as expressions of if:
mytypes.exists[ G |- it <: otherType ]
if ( { G |- it <: otherType } ) { ... }
Note that, since a rule invocation is NOT an expression, when used in an if, needs to be put inside a block.
Fixed in https://github.com/LorenzoBettini/xsemantics/commit/5f5e252eeeb52e438f4affeeec46e904e949b381
At the moment, it is not possible to use a boolean judgment (relation) inside another rule. E.g., given
judgments { func |- EObject obj : output EObject
rel |– EObject left <: EObject right }
if is not possible to write a rule like
rule funcX G |- X obj: output EObject out from { if ( G |- X <: X.feature ) { ... } else { ... } }
Well, in the example one might rephrase the statement and use an "or" expression. But in other cases that's not possible.