# Writing a macro that generates a function

**URL:** <https://discourse.julialang.org/t/writing-a-macro-that-generates-a-function/132315>\
**Category:** General Usage\
**Created:** [September 12, 2025, 9:10am UTC](https://discourse.julialang.org/t/writing-a-macro-that-generates-a-function/132315 "2025-09-12T09:10:59Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![SeSodesa](https://avatars.discourse-cdn.com/v4/letter/s/dc4da7/32.png) [@SeSodesa](https://discourse.julialang.org/u/SeSodesa)\
**Post date:** [September 12, 2025, 9:38am UTC](https://discourse.julialang.org/t/writing-a-macro-that-generates-a-function/132315/5 "2025-09-12T09:38:31Z")

</div>

I also wonder what would happen if I did “function piracy” like

```julia
@generated function Base.:+(a::T,b::T)
     ...
end # function
```

---

_[View the full topic](https://discourse.julialang.org/t/writing-a-macro-that-generates-a-function/132315)._
