# Why distinguish macro names with @?

**URL:** <https://discourse.julialang.org/t/why-distinguish-macro-names-with/81001>\
**Category:** Internals & Design\
**Created:** [May 13, 2022, 8:57am UTC](https://discourse.julialang.org/t/why-distinguish-macro-names-with/81001 "2022-05-13T08:57:33Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [May 13, 2022, 1:38pm UTC](https://discourse.julialang.org/t/why-distinguish-macro-names-with/81001/21 "2022-05-13T13:38:10Z")

</div>

> [@barfo](#):
>
> The negative side is code which looks like modem noise… [if anyone remembers modem noise]

I _do_ remember modem noise 🙂 But noise is the opposite of signal, the `@` carries signal here. It’s the opposite of line noise, which is just extra letters without any useful information.

---

<div class="post-metadata">

**Author:** ![barfo](https://avatars.discourse-cdn.com/v4/letter/b/8baadc/32.png) [@barfo](https://discourse.julialang.org/u/barfo)\
**Post date:** [May 13, 2022, 1:40pm UTC](https://discourse.julialang.org/t/why-distinguish-macro-names-with/81001/22 "2022-05-13T13:40:34Z")

</div>

Yup just extra @'s without useful information.

I wouldn’t put a smiley on being able to remember modem noise.  
barfo.

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [May 13, 2022, 1:41pm UTC](https://discourse.julialang.org/t/why-distinguish-macro-names-with/81001/23 "2022-05-13T13:41:36Z")

</div>

> [@barfo](#):
>
> I wouldn’t put a smiley on being able to remember modem noise.

No, it’s just line noise (😉 )

---

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [May 13, 2022, 1:44pm UTC](https://discourse.julialang.org/t/why-distinguish-macro-names-with/81001/24 "2022-05-13T13:44:24Z")

</div>

The `@f(...)` syntax is unnecessary, and can be argued to be a _complication_, yet I welcome it with open arms. The alternative for a macro with multiple arguments which each is an expression and do not fit into a line is:

```julia
(@f (...) (...)
    (...) (...))

```

I never programmed in Lisp, but I believe that maybe your nostalgia is being a tad bit strong if you prefer everyone to be forced to write this case this way.

---

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [May 13, 2022, 1:54pm UTC](https://discourse.julialang.org/t/why-distinguish-macro-names-with/81001/25 "2022-05-13T13:54:13Z")

</div>

> [@barfo](#):
>
> Yup just extra @'s without useful information.

I can hardly believe you are arguing in good faith if you just disregard everyone’s points on why they find that `@` transmit useful information and just state the contrary as a fact. If you have an eidetic memory, read the whole Base API, and always read the whole API for every package of every code that you will work with, and therefore remember which identifiers are macros and which aren’t, well, good for you, but the language will not be tailored for your specific use case.

As you mentioned, other languages gone the same path, and it is probably for the same reason; this is, the cost of one extra character dwarfs in comparison with the usefulness of immediately knowing if it is a macro or a function that is being invoked. I have used JuMP which API is mostly macros and I found no problem in typing some `@` for extra clarity.

I do imagine that you are also against putting `!` at the end of functions that mutate their arguments based on the same principle.

---

<div class="post-metadata">

**Author:** ![barfo](https://avatars.discourse-cdn.com/v4/letter/b/8baadc/32.png) [@barfo](https://discourse.julialang.org/u/barfo)\
**Post date:** [May 13, 2022, 1:54pm UTC](https://discourse.julialang.org/t/why-distinguish-macro-names-with/81001/26 "2022-05-13T13:54:46Z")

</div>

No nostalgia involved, what’s the difference between …

> [@Henrique\_Becker](#):
>
> ```julia
> (@f (...) (...)
> (...) (...))
> 
> ```

and

```julia
@f((...), 
   (...),
   (...),
   (...))

```

?

extra comma’s in the later maybe?  
barfo.

---

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [May 13, 2022, 1:57pm UTC](https://discourse.julialang.org/t/why-distinguish-macro-names-with/81001/27 "2022-05-13T13:57:04Z")

</div>

The second version could be:

```julia
@f(..., 
   ...,
   ...,
   ...)

```

No inner parenthesis needed.

---

<div class="post-metadata">

**Author:** ![barfo](https://avatars.discourse-cdn.com/v4/letter/b/8baadc/32.png) [@barfo](https://discourse.julialang.org/u/barfo)\
**Post date:** [May 13, 2022, 1:59pm UTC](https://discourse.julialang.org/t/why-distinguish-macro-names-with/81001/28 "2022-05-13T13:59:22Z")

</div>

Assuming the parenthesis were necessary is the first they are necessary in the second.  
barfo

---

<div class="post-metadata">

**Author:** ![barfo](https://avatars.discourse-cdn.com/v4/letter/b/8baadc/32.png) [@barfo](https://discourse.julialang.org/u/barfo)\
**Post date:** [May 13, 2022, 2:00pm UTC](https://discourse.julialang.org/t/why-distinguish-macro-names-with/81001/29 "2022-05-13T14:00:24Z")

</div>

ignoring the difference between prefix and infix notation.

---

<div class="post-metadata">

**Author:** ![barfo](https://avatars.discourse-cdn.com/v4/letter/b/8baadc/32.png) [@barfo](https://discourse.julialang.org/u/barfo)\
**Post date:** [May 13, 2022, 2:00pm UTC](https://discourse.julialang.org/t/why-distinguish-macro-names-with/81001/30 "2022-05-13T14:00:46Z")

</div>

for the inner expressions

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [May 13, 2022, 2:02pm UTC](https://discourse.julialang.org/t/why-distinguish-macro-names-with/81001/31 "2022-05-13T14:02:51Z")

</div>

If you inadvertently push ‘Reply’ before your post is finished, you can click edit (the pencil sign) under your post, to finish it.

---

<div class="post-metadata">

**Author:** ![barfo](https://avatars.discourse-cdn.com/v4/letter/b/8baadc/32.png) [@barfo](https://discourse.julialang.org/u/barfo)\
**Post date:** [May 13, 2022, 2:05pm UTC](https://discourse.julialang.org/t/why-distinguish-macro-names-with/81001/32 "2022-05-13T14:05:18Z")

</div>

yeah…lazy… late here sorry.

---

<div class="post-metadata">

**Author:** ![barfo](https://avatars.discourse-cdn.com/v4/letter/b/8baadc/32.png) [@barfo](https://discourse.julialang.org/u/barfo)\
**Post date:** [May 13, 2022, 2:14pm UTC](https://discourse.julialang.org/t/why-distinguish-macro-names-with/81001/33 "2022-05-13T14:14:56Z")

</div>

And I am just playing devil’s advocate here. I think the language is almost ok. And the implementation has clearly been done well. There are a few things I don’t get, @ being the main one and the “@f …” syntax probably messes with how I think that should work. At a minimum it makes it what I think should happen _hard_ and I don’t understand its benefit.

night night,  
barfo.

---

<div class="post-metadata">

**Author:** ![liuyxpp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/liuyxpp/32/9870_2.png) [@liuyxpp](https://discourse.julialang.org/u/liuyxpp)\
**Post date:** [May 13, 2022, 2:57pm UTC](https://discourse.julialang.org/t/why-distinguish-macro-names-with/81001/34 "2022-05-13T14:57:10Z")

</div>

May I say that I REALLY LOVE this @, which alerts me I am using a macro. As typical scientists, we are most of the time the consumers of macros. And I will take extreme care of these things since it is pretty hard to identify a bug (especially numerically related) involving macros. I feel fortunate that Julia has a tremendous visual hint for macros.

---

<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 13, 2022, 3:18pm UTC](https://discourse.julialang.org/t/why-distinguish-macro-names-with/81001/35 "2022-05-13T15:18:42Z")

</div>

Remember that @jeff.bezanson is a lisper at heart. [Here are his reasons](https://github.com/JuliaLang/julia/blob/3c354b4a391307d84915445bdd6fb464371f30fc/doc/at_macro_reasons) for using the `@` sigil back in 2010:

> [@Email thread with Jeff in 2010](#):
>
> As a lisper, I of course understand the ugliness of @. But I think on the balance it is worth it:
> 
> - it alerts you that something different is happening
> - it prevents macro names from conflicting with other things
> - it allows macros to have paren-less syntax
> - it makes it easy to syntax color macros like keywords
> - it makes it easier to save pre-expanded code. otherwise, it would be possible for an expression in one file to turn into a macro call as a result of a definition changing in another file (e.g. changing something from a function to a macro). with @, files stay self-contained since we know exactly which expressions to delay expanding.

---

<div class="post-metadata">

**Author:** ![jeff.bezanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeff.bezanson/32/48_2.png) [@jeff.bezanson](https://discourse.julialang.org/u/jeff.bezanson)\
**Post date:** [May 13, 2022, 3:41pm UTC](https://discourse.julialang.org/t/why-distinguish-macro-names-with/81001/36 "2022-05-13T15:41:40Z")

</div>

> [@barfo](#):
>
> which bits of lisp are macros and which bits aren’t, answer: don’t know, don’t care.

It does matter though, because macros aren’t first class. Given `(f x)`, if `f` is a macro you can’t e.g. use it as an argument to `map`.

> [@barfo](#):
>
> yeah well there is the @f … versus @f(…) syntax thing.

Yes we could live without that.

---

<div class="post-metadata">

**Author:** ![aplavin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aplavin/32/222056_2.png) [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Post date:** [May 13, 2022, 3:45pm UTC](https://discourse.julialang.org/t/why-distinguish-macro-names-with/81001/37 "2022-05-13T15:45:08Z")

</div>

> [@DNF](#):
>
> Hey. I can actually do
> 
> ```julia
> m = var"@btime"
> 
> ```
> 
> But can’t call it.

You can, the variable name should just start with `@`:

```julia
julia> var"@mytime" = var"@time"
@time (macro with 2 methods)

julia> @mytime 123
  0.000001 seconds
123

```

---

<div class="post-metadata">

**Author:** ![barfo](https://avatars.discourse-cdn.com/v4/letter/b/8baadc/32.png) [@barfo](https://discourse.julialang.org/u/barfo)\
**Post date:** [May 13, 2022, 3:45pm UTC](https://discourse.julialang.org/t/why-distinguish-macro-names-with/81001/38 "2022-05-13T15:45:28Z")

</div>

No idea who @jeff.bezanson is… remember I’m the devil…

- who cares
- huh?
- don’t know why you want this anyway
- only green on my vt220
- emacs can figure it out anyway
- makes no sense at all… if it’s precompiled it’s precompiled, get over it if it goes wrong.

some who knows how, kill off this thread. It’s pointless noise now.  
barfo.

---

<div class="post-metadata">

**Author:** ![barfo](https://avatars.discourse-cdn.com/v4/letter/b/8baadc/32.png) [@barfo](https://discourse.julialang.org/u/barfo)\
**Post date:** [May 13, 2022, 3:52pm UTC](https://discourse.julialang.org/t/why-distinguish-macro-names-with/81001/39 "2022-05-13T15:52:12Z")

</div>

> [@jeff.bezanson](#):
>
> It does matter though, because macros aren’t first class. Given `(f x)` , if `f` is a macro you can’t e.g. use it as an argument to `map` .

True… but that doesn’t explain the need to announce f as a macro. If it is, then (map f …) will fail in some random implementation defined way and it’ll do that whether it’s called ‘f’ or ‘@f’.

At least for the syntax which looks like a function call all you’ve done is add @ to the front of all the names.

I haven’t thought about the other syntax because it would not occur to me to use it.  
barfo.

---

<div class="post-metadata">

**Author:** ![oxinabox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oxinabox/32/206603_2.png) [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Post date:** [May 13, 2022, 4:18pm UTC](https://discourse.julialang.org/t/why-distinguish-macro-names-with/81001/40 "2022-05-13T16:18:20Z")

</div>

> [@barfo](#):
>
> No idea who @jeff.bezanson is

> **[Jeff Bezanson (programmer)](https://en.wikipedia.org/wiki/Jeff_Bezanson_(programmer))**
>
> Jeff Bezanson (born December 26, 1981) is a computer scientist best known for co-creating the Julia programming language with Stefan Karpinski, Alan Edelman and Viral B. Shah in 2012. The language spawned Julia Computing Inc. (since then renamed to JuliaHub Inc.) of which Bezanson is the CTO. As a founder of the company and co-creator of the language, Bezanson earned the 2019 J.H. Wilkinson Prize for his work on the Julia programming language alongside Shah and Karpinski. Bezanson After receivin...

[Previous page](https://discourse.julialang.org/t/why-distinguish-macro-names-with/81001.md?page=1)

[Next page](https://discourse.julialang.org/t/why-distinguish-macro-names-with/81001.md?page=3)
