# \`Base.@show\` macro breaks operator precedence

**URL:** <https://discourse.julialang.org/t/base-show-macro-breaks-operator-precedence/96879>\
**Category:** General Usage\
**Tags:** bug\
**Created:** [March 31, 2023, 6:59am UTC](https://discourse.julialang.org/t/base-show-macro-breaks-operator-precedence/96879 "2023-03-31T06:59:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RainerHeintzmann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rainerheintzmann/32/19726_2.png) [@RainerHeintzmann](https://discourse.julialang.org/u/RainerHeintzmann)\
**Post date:** [March 31, 2023, 6:59am UTC](https://discourse.julialang.org/t/base-show-macro-breaks-operator-precedence/96879/1 "2023-03-31T06:59:31Z")

</div>

I just stumbled over the following problem using `@show`:

```julia
julia> @show a=4/2+1;
a = 4 / 2 + 1 = 3.0

julia> @show a=4/2 +1;
a = 4 / 2 = 2.0
1 = 1

julia> a
2.0

julia> @show a=(4/2 +1);
a = 4 / 2 + 1 = 3.0

julia> a
3.0

```

In the second example the space obviously split the expression into two, which I did not expect and I also did not recognise as such at first. This caused me quite some trouble during debugging, since I did not expect `@show` to essentially alter my code. You could argue that I should not have put a space, but in my case the space was even unavoidable, since I used something like this

```julia
julia> @show a=(4,3).÷2 .+1;
a = (4, 3) .÷ 2 = (2, 1)
(.+)(1) = 1

```

I am using Julia V1.8.2.

---

<div class="post-metadata">

**Author:** ![tecosaur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tecosaur/32/23206_2.png) [@tecosaur](https://discourse.julialang.org/u/tecosaur)\
**Post date:** [March 31, 2023, 7:09am UTC](https://discourse.julialang.org/t/base-show-macro-breaks-operator-precedence/96879/2 "2023-03-31T07:09:28Z")

</div>

I think this is an inherent issue with how macros split arguments. Try adding parenthesis:

- `@show( a=4/2 +1 )`
- `@show (a=4/2 +1)`

---

<div class="post-metadata">

**Author:** ![RainerHeintzmann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rainerheintzmann/32/19726_2.png) [@RainerHeintzmann](https://discourse.julialang.org/u/RainerHeintzmann)\
**Post date:** [March 31, 2023, 7:27am UTC](https://discourse.julialang.org/t/base-show-macro-breaks-operator-precedence/96879/3 "2023-03-31T07:27:05Z")

</div>

Yes. I also found this is an option, yet for a quick debugging its a little annoying to keep thinking about added brackets. But I can see that this is a general issue with macro argument splitting.
