Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Precedence Issue of as and Binary Operations #3284

Open
A4-Tacks opened this issue Mar 5, 2025 · 0 comments
Open

The Precedence Issue of as and Binary Operations #3284

A4-Tacks opened this issue Mar 5, 2025 · 0 comments

Comments

@A4-Tacks
Copy link

A4-Tacks commented Mar 5, 2025

link 01mf02/jaq#261

$ jq -n '"x" as $n | "a"+"y" as $s | $n+","+$s'
"ax,y"

Like:

$ jq -n '"x" as $n | "a"+("y" as $s | $n+","+$s)'
"ax,y"

Or (scope has some impact):

jq: error: $s is not defined at <top-level>, line 1:
"x" as $n | "a"+("y" as $s | $n)+","+$s
jq: 1 compile error

Intuitively, it should be:

$ jq -n '"x" as $n | ("a"+"y") as $s | $n+","+$s'
"x,ay"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant