# What is the @named macro needed for?

**URL:** https://discourse.julialang.org/t/what-is-the-named-macro-needed-for/107647
**Category:** Modelling & Simulations
**Tags:** question, modelingtoolkit
**Created:** [December 15, 2023, 8:28am UTC](https://discourse.julialang.org/t/what-is-the-named-macro-needed-for/107647 "2023-12-15T08:28:21Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [December 15, 2023, 8:28am UTC](https://discourse.julialang.org/t/what-is-the-named-macro-needed-for/107647/1 "2023-12-15T08:28:21Z")

</div>

Why is the `@named` macro needed here:

```julia
@named sys = ODESystem(eqs, t)

```

I am NOT giving a name to the ODE system… But I get an error if I leave it out.

---

<div class="post-metadata">

### Author: ![de-souza](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/de-souza/32/43417_2.png) [@de-souza](https://discourse.julialang.org/u/de-souza)
#### Post date: [December 15, 2023, 8:41am UTC](https://discourse.julialang.org/t/what-is-the-named-macro-needed-for/107647/2 "2023-12-15T08:41:15Z")

</div>

You can see what a macro does with the [@macroexpand macro](https://docs.julialang.org/en/v1/base/base/#Base.@macroexpand):

```julia
julia> @macroexpand @named sys = ODESystem(eqs, t)
:(sys = ODESystem(eqs, t; name = :sys))

```

The [@named macro](https://github.com/SciML/ModelingToolkit.jl/blob/ab2c452/src/systems/abstractsystem.jl#L1142-L1176) just adds a “name” keyword argument to a function call. As for why this is needed, the ODESystem constructor [requires it](https://github.com/SciML/ModelingToolkit.jl/blob/ab2c452/src/systems/diffeqs/odesystem.jl#L192-L193).

---

<div class="post-metadata">

### Author: ![Datseris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datseris/32/13406_2.png) [@Datseris](https://discourse.julialang.org/u/Datseris)
#### Post date: [December 15, 2023, 8:48am UTC](https://discourse.julialang.org/t/what-is-the-named-macro-needed-for/107647/3 "2023-12-15T08:48:05Z")

</div>

It will gives the name of the variable (here sys) automatically. All system instances need a name.

CU!

George Datseris (he/him)
