# General Registry: Create tag for macro usage

**URL:** <https://discourse.julialang.org/t/general-registry-create-tag-for-macro-usage/104528>\
**Category:** New to Julia\
**Created:** [October 3, 2023, 8:42am UTC](https://discourse.julialang.org/t/general-registry-create-tag-for-macro-usage/104528 "2023-10-03T08:42:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShalokShalom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shalokshalom/32/52462_2.png) [@ShalokShalom](https://discourse.julialang.org/u/ShalokShalom)\
**Post date:** [October 3, 2023, 8:42am UTC](https://discourse.julialang.org/t/general-registry-create-tag-for-macro-usage/104528/1 "2023-10-03T08:42:22Z")

</div>

In a recent discussion about newbie friendliness, the topic about [macros](https://discourse.julialang.org/t/julia-as-first-language/104383/79) came up.

Someone suggested, that it may be beneficial to prevent auto merges to the general registry, for code that uses them. I think that’s a bit too harsh.

But what about creating a tag, so that we can review the PR, and possibly comment on the overuse of it?

Macros are overused in nearly every language that uses them, and I think this could be a way to deal with this issue.

Eventually might even the compiler be able to give good advice to alternatives.

Like:

```plaintext
You seem to be using a macro for xyz. It seems this could also be done with closures. 
Macros are for rare edge cases, and not to be used lightly, as they can make code hard to read.

```

I don’t know if the compiler is ready for that, but setting up the registry, seems doable right now.  
So people could review code, with that purpose.

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [October 3, 2023, 9:23am UTC](https://discourse.julialang.org/t/general-registry-create-tag-for-macro-usage/104528/2 "2023-10-03T09:23:15Z")

</div>

Perhaps a VSCode plugin?

 ![Screenshot 2023-10-03 at 10.17.44](https://global.discourse-cdn.com/julialang/original/3X/3/6/36c43d14b5ae268e769d0cef5f4b942937b28804.png)

---

<div class="post-metadata">

**Author:** ![goerz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerz/32/3269_2.png) [@goerz](https://discourse.julialang.org/u/goerz)\
**Post date:** [October 3, 2023, 10:31am UTC](https://discourse.julialang.org/t/general-registry-create-tag-for-macro-usage/104528/3 "2023-10-03T10:31:44Z")

</div>

> [@ShalokShalom](#):
>
> Macros are overused in nearly every language that uses them, and I think this could be a way to deal with this issue.

I have yet to see that this is an issue with Julia. I don’t think I’ve come across any overuse.

Macros are a bit of a pain to write, but beyond that, they’re a perfectly normal feature of the language. Not that I’m opposed to applying a tag to packages that define macros, but I wouldn’t consider it a stigma at all.

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [October 3, 2023, 12:23pm UTC](https://discourse.julialang.org/t/general-registry-create-tag-for-macro-usage/104528/4 "2023-10-03T12:23:52Z")

</div>

> [@ShalokShalom](#):
>
> Eventually might even the compiler be able to give good advice to alternatives.
> 
> Like:
> 
> ```julia
> You seem to be using a macro for xyz. It seems this could also be done with closures. 
> Macros are for rare edge cases, and not to be used lightly, as they can make code hard to read.
> 
> ```

If you’re right, maybe we should do this (but only in the REPL) for all macros? It seems not too hard. I mean if done unconditionally. I’m not sure what you meant by “for xyz”, to analyze the macro for complexity, and only warn when some level exceeded? Then harder and I’m not sure needed.

> [@goerz](#):
>
> I don’t think I’ve come across any overuse.

I only recall trying to locate a function definition, and not finding it. That’s annoying. Or rather I found it but it was a macro and/or eval (I understand you sometimes want that for the convenience of the package maker, but less ideal to read for the user?). I forget the details. E.g. for Genie.jl package.

P.S. Can someone make a macro for that Clippy advice…? And I’m sort of serious, maybe some warnings should be that obvious; and not take up extra lines in the REPL.

---

<div class="post-metadata">

**Author:** ![ShalokShalom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shalokshalom/32/52462_2.png) [@ShalokShalom](https://discourse.julialang.org/u/ShalokShalom)\
**Post date:** [October 3, 2023, 1:09pm UTC](https://discourse.julialang.org/t/general-registry-create-tag-for-macro-usage/104528/5 "2023-10-03T13:09:30Z")

</div>

> [@goerz](#):
>
> I have yet to see that this is an issue with Julia. I don’t think I’ve come across any overuse.

Might as well be. I know its an issue in other languages, and other people, as in my initial link, said its overused.

I guess depends on where you look at.

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [October 3, 2023, 1:13pm UTC](https://discourse.julialang.org/t/general-registry-create-tag-for-macro-usage/104528/6 "2023-10-03T13:13:36Z")

</div>

> [@Palli](#):
>
> I understand you sometimes want that for the convenience of the package maker

It’s not only about convenience. Having to write a large number of similar function definitions is rather error prone. There are certainly tradeoffs with `@eval` loops but they shine at being consistent.

---

<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:** [October 3, 2023, 1:24pm UTC](https://discourse.julialang.org/t/general-registry-create-tag-for-macro-usage/104528/7 "2023-10-03T13:24:42Z")

</div>

Let’s consolidate this discussion over at the simultaneous #Internals & Design post that’s also about how to handle registry submissions that export macros. This is more of an internals/governance sort of thing than it is #New to Julia.

> [@How to discourage macros: disable automerge of General registry PRs?](https://discourse.julialang.org/t/how-to-discourage-macros-disable-automerge-of-general-registry-prs/104529):
>
> It seems to me that macros are defined much too often in the Julia ecosystem and the (error-prone) definitions of such macros are often very complex. FWIW, the Julia Manual page on metaprogramming already heavily discourages defining macros: eval and defining new macros should be typically used as a last resort. It seems to me that (almost?) the only good way to design a package that includes macros is like this: the macro simply provides some syntax sugar over an actual Julia function, w…

---

<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:** [October 3, 2023, 1:24pm UTC](https://discourse.julialang.org/t/general-registry-create-tag-for-macro-usage/104528/8 "2023-10-03T13:24:47Z")

</div>


