# Space issue with the @. macro

**URL:** <https://discourse.julialang.org/t/space-issue-with-the-macro/129032>\
**Category:** General Usage\
**Created:** [May 15, 2025, 12:44pm UTC](https://discourse.julialang.org/t/space-issue-with-the-macro/129032 "2025-05-15T12:44:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [May 15, 2025, 12:44pm UTC](https://discourse.julialang.org/t/space-issue-with-the-macro/129032/1 "2025-05-15T12:44:28Z")

</div>

Is this normal/documented ?

```julia
julia> x = 1
1

julia> b = x -3 * x^2
-2

julia> x = [1,2,3]
3-element Vector{Int64}:
 1
 2
 3

julia> b = @. x - 3 * x^2
3-element Vector{Int64}:
  -2
 -10
 -24

julia> b = @. x -3 * x^2
ERROR: LoadError: MethodError: no method matching var"@ __dot__"(::LineNumberNode, ::Module, ::Symbol, ::Expr)
The function `@ __dot__ ` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  var"@ __dot__"(::LineNumberNode, ::Module, ::Any)
   @ Base broadcast.jl:1303

```

Julia 1.11.3

---

<div class="post-metadata">

**Author:** ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Post date:** [May 15, 2025, 12:59pm UTC](https://discourse.julialang.org/t/space-issue-with-the-macro/129032/2 "2025-05-15T12:59:18Z")

</div>

That seems like a bug. There’s only one method for `@.`, which expects a single expression. There should probably be another method that accepts multiple expressions and concatenates them together. (Macro parsing turns `x -3 * x^2` into two expressions, `x` and `-3 * x^2`.)

It works if you call the macro with parentheses:

```julia-repl
julia> x = [1, 2, 3]
3-element Vector{Int64}:
 1
 2
 3

julia> @.(x -3 * x^2)
3-element Vector{Int64}:
  -2
 -10
 -24

```

EDIT:  
I just looked at the docstring for `@.`. It’s technically not a bug, because the docstring documents the call as `@. expr`. In other words, the docstring shows that one expression is expected (though it does not emphasize the fact that only one expression is allowed). However, it might be nice if they could make something like `@. x -3 * x^2` work.

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [May 15, 2025, 1:16pm UTC](https://discourse.julialang.org/t/space-issue-with-the-macro/129032/3 "2025-05-15T13:16:15Z")

</div>

Yeah, but it’s still pretty surprising that `x -3 * x^2` counts as two expressions in the context of a macro call. That said, it’s quite similar to:

```julia
julia> b = [x -3 * x^2]
1×2 Matrix{Int64}:
 1 -3

```

---

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [May 15, 2025, 1:24pm UTC](https://discourse.julialang.org/t/space-issue-with-the-macro/129032/4 "2025-05-15T13:24:45Z")

</div>

yep, it’s not evidently obvious that the parser treats that as a single expression if a space is used, and as two expressions if there is no space…

---

<div class="post-metadata">

**Author:** ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)\
**Post date:** [May 15, 2025, 1:36pm UTC](https://discourse.julialang.org/t/space-issue-with-the-macro/129032/5 "2025-05-15T13:36:33Z")

</div>

No but it’d be nice if someone could [document space-sensitive parsing in array and macro syntax · Issue #30096 · JuliaLang/julia](https://github.com/JuliaLang/julia/issues/30096)
