yurloc commented on code in PR #5907:
URL:
https://github.com/apache/incubator-kie-drools/pull/5907#discussion_r1593782757
##########
drools-drl/drools-drl-parser/src/main/java/org/drools/drl/parser/antlr4/DRLVisitorImpl.java:
##########
@@ -803,12 +803,19 @@ public AccumulateDescr
visitFromAccumulate(DRLParser.FromAccumulateContext ctx)
@Override
public AccumulateDescr.AccumulateFunctionCallDescr
visitAccumulateFunction(DRLParser.AccumulateFunctionContext ctx) {
String function = ctx.drlIdentifier().getText();
- String bind = ctx.label() == null ? null :
ctx.label().drlIdentifier().getText();
+ String bind = null;
+ boolean unify = false;
+ if (ctx.label() != null) {
Review Comment:
@gitgabrio's version looks good but does an unnecessary check. I'm not
concerned about efficiency but it slightly hides the fact that `ctx.label()`
and `ctx.unify()` can't be both non-null. The original version is clear in this
regard.
@tkobayas's version is more "efficient" because it skips the `label` check
if `unif` is present. But it's a bit harder to read than the original version.
I believe we all agree that the art of coding is not about optimizing the
code size (by creating one-liners in the extreme case) but optimizing the code
to be easy to understand, unambiguous, and less error-prone.
I prefer the original version in this case.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]