Originally posted by: SystemAdmin
[MJEber said:]
from a language parser point of view here is why it is a bug:
Breaking the statement down into simpler terms you have
sum( item in Data [: {condition}] ) a*b*c + d*e*c [ comparator ] | [] is optional data
From this statement: presedence should be applied only to the summation statement, not the total sum statement. Thus presedence should be applied only to the statements after the sum() statement. The comparator becomes the point where presedence application stops, since it no longer represents a mathematical presentation of data, but rather comparator data.
The presendence order that you suggest should only be applied if the parser encounters a new aggregate statement. In a parse tree you would then have
sum < -- top of parse tree<br /> + < -- next level of parse tree<br /> a*b*c d*e*c < -- multiplicand level of parse tree<br />
Now if it is written as follows
aggregate( d in collection ) d*b*c + sum( f in collection ) d*e*c
you now have precedence in the parse tree that should create the error as long as I don't override the precedence order. In this case it is correct by your statement that in the second set of data, the variable d is undefined since it is in a new logic layer of the parsing tree.
That is why it is a bug. (speaking pure parsing tree logic)
#DecisionOptimization#OPLusingCPLEXOptimizer