jq handles "$-arguments" in function definitions as implicit "as" statements,
whereas gojq does not. This introduces a source of potential inconsistency.
Consider for example:
def prod: .[0] * .[1];
def prodEqual($p): prod == $p;
This works as expected in both jq and gojq.
However, if prodEq were defined as:
def prodEq($prod): prod == $prod;
then we would see the discrepancy, as jq implicitly expands
the definition of prodEq to
def prodEq($prod): prod as $prod | prod == $prod;
Because of shadowing, in jq, prodEq would therefore always returns true!
For example:
[1,1] | prodEq(0) #=> true using jq
[1,1] | prodEq(0) #=> false using gojq
jq handles "$-arguments" in function definitions as implicit "as" statements,
whereas gojq does not. This introduces a source of potential inconsistency.
Consider for example:
This works as expected in both jq and gojq.
However, if prodEq were defined as:
then we would see the discrepancy, as jq implicitly expands
the definition of prodEq to
Because of shadowing, in jq, prodEq would therefore always returns true!
For example: