# @compat macro

**URL:** <https://discourse.julialang.org/t/compat-macro/3899>\
**Category:** General Usage\
**Created:** [May 24, 2017, 6:31am UTC](https://discourse.julialang.org/t/compat-macro/3899 "2017-05-24T06:31:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohamed82008](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mohamed82008/32/18171_2.png) [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Post date:** [May 24, 2017, 6:31am UTC](https://discourse.julialang.org/t/compat-macro/3899/1 "2017-05-24T06:31:49Z")

</div>

Could someone please explain how the compat macro works from Compat.jl? I went through the source code, but it wasn’t very clear. It seems to enable defining constructors for families of types simultaneously, is that right, and is it the only way it can be used? Thanks a lot in advance.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [May 24, 2017, 6:35am UTC](https://discourse.julialang.org/t/compat-macro/3899/2 "2017-05-24T06:35:31Z")

</div>

Read the README. It’s a very complicated macro to provide compatibility to features of Julia on versions which did not includes those features, or version of Julia which had slightly different syntax. The README explains all of the cases that it currently covers.

---

<div class="post-metadata">

**Author:** ![mohamed82008](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mohamed82008/32/18171_2.png) [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Post date:** [May 24, 2017, 6:54am UTC](https://discourse.julialang.org/t/compat-macro/3899/3 "2017-05-24T06:54:53Z")

</div>

So is there anything that can be done using Compat.jl but not without it in the newest versions of Julia? In other words, when developing new modules, will I ever need to use it, or is it just for the easy reuse of legacy modules?

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [May 24, 2017, 6:57am UTC](https://discourse.julialang.org/t/compat-macro/3899/4 "2017-05-24T06:57:45Z")

</div>

> [@mohamed82008](#):
>
> So is there anything that can be done using Compat.jl but not without it in the newest versions of Julia?

No

> [@mohamed82008](#):
>
> In other words, when developing new modules, will I ever need to use it, or is it just for the easy reuse of legacy modules?

Depends on what you’re developing. If you’re developing large libraries that allow users to use different versions of Julia, you need to use it in order to be able to release a version which someone on Julia v0.4 or v0.6 can use. If you’re developing libraries for yourself, you’re just getting started, or you just don’t care about supporting older versions of Julia, then you don’t need it.
